Thunderbird loads System File as Mail Folder
Categories
(MailNews Core :: Database, defect)
Tracking
(Not tracked)
People
(Reporter: lars.andersen, Assigned: aceman)
Details
Attachments
(1 file, 1 obsolete file)
9.48 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.99 Safari/537.36 Vivaldi/2.9.1705.41
Steps to reproduce:
My Thunderbird "Local Folders" are pointing to C:\Users\Lars\Emails\Local Folders
Then I add an Icon to this folder (Right Click, Properties, Customize, Change Icon)
The new icon gets stored in C:\Users\Lars\Emails\Local Folders\desktop.ini
Desktop.ini is a new Hidden System File containing the link to the new icon
Actual results:
When opening Thunderbird, under "Local Folders", a new folder called "desktop.ini" appears (and the system also adds a folder called "desktop.ini.msf" to the C:\Users\Lars\Emails\Local Folders directory.
Naturally this "desktop.ini" folder is empty.
Expected results:
Thunderbird should never load a System File (whether hidden or not) as a mail folder but should only load User Files.
Tested also v.71.0b3 (64 Bits) - same issue
Comment 1•5 years ago
|
||
I don't know that we would fix this. System file or not, you caused it to be created and are touching a structure that belongs Thunderbird. By design TB displays any file in these directories that it does next expect as a mail folder
Reporter | ||
Comment 2•5 years ago
|
||
OK - each file in a directory has Attributes e.g. is the file a system file, a hidden file etc. so when issuing the command to read a directory, it must be possible to exclude system files all together.
I don't know which command you use to retrieve the content of a directory for processing. If it is the DIR command, then it's easy to exclude system files using the attribute parameter. The Unix equivalent "LS" has similar functionality - as the system files are clearly "Tagged".
Windows could add other system files to a directory such as thumbs.db - these system files are only partially under user control.
When Thunderbird decides to open one of the system files, and if I move a message to that file, then the system file will be corrupted and Windows won't know what to do with it - that the fundamental issue.
It's not just happening with the "Local Folders" directory, it also happens in individual Mail Account Directories - when a system file is present.
Don't know if this should be an "Enhancement", I logged it as a bug due to the risk of system file corruption with the current behaviour.
Reporter | ||
Comment 3•5 years ago
|
||
Assume Thunderbird is Java based - just wanted to ad a couple of classes which allows to find both the "Hidden" and the "System" attribute.
http://www.java2s.com/Tutorials/Java/Java_io/1000__Java_nio_File_Attributes.h
https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/DosFileAttributeView.html
As stated before, my personal opinion is, that Thunderbird should not touch a file if it is hidden or if it is a system file ......
Hope for a positive answer to this request
all the best,
Lars
I think this sounds useful.
We already have infrastructure to ignore some files in the filesystem folders and not turn them into mail folders, for some internal TB files.
It is true that Windows creates hidden files in folders, like for the thumbnails, and apparently the desktop.ini file.
This would need some platform specific code to determine what is a hidden or system file on each platform. Windows does use the file attributes. On Linux e.g. dot named files are considered hidden or special device type files could be ignored. The same could be on OS X.
Lars, this code in Thunderbird is in C++, not Java. Do you have some sample code for getting the file attributes in Windows?
Comment 5•5 years ago
|
||
Aceman, can probably use file.isHidden: https://searchfox.org/comm-central/source/mozilla/xpcom/io/nsIFile.idl#276
Lars: no Java in Thunderbird. It's JavaScript, C++ and some Rust.
Thanks, and also nsIFile.isSpecial seems to cover the system files on Windows and device files on Linux.
In that case I can do something here.
I have tested this on Linux where the patch successfully ignored a block device file. Hidden files (starting with a dot) were already ignored by an explicit check for 'temporary' files in nsMsgLocalStoreUtils::nsShouldIgnoreFile (visible in the patch).
It could use some testing on Windows and OS X by dropping some hidden or system files into the profile/Mail/server folder.
The directoryEnumerator shuffling in ImapFolder is to make that logic more similar to the same loops in nsMsgBrk*Store, but also to fix a theoretical bug when after fetching the last directory entry we checked children->HasMoreElements(&more) again and if that would fail, we wouldn't process the last dir entry (currentFolderPath) but exit.
Comment 8•5 years ago
|
||
Comment on attachment 9112718 [details] [diff] [review] 1598865.patch This works on Windows. On macOS hidden files (the ones with leading dot) are already hidden like on Linux. I don't know how to copy a block device into the folder under macOS but I think it's similar to Linux and would also hide them like on Linux.
Thanks. Adding a comment to the new check block.
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Comment on attachment 9112765 [details] [diff] [review] 1598865.patch v1.1 Review of attachment 9112765 [details] [diff] [review]: ----------------------------------------------------------------- Thx! r=mkmelin
Comment 12•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/375496910e92
do not use new hidden/system files detected in mail account local storage as mail folders. r=mkmelin
Updated•5 years ago
|
Updated•5 years ago
|
Comment 13•4 years ago
|
||
Good work. And thanks for suggesting this.
Description
•