Comment 20 for bug 65164

Revision history for this message
Stefan Rehm (stefan-rehm) wrote : Re: Firefox 2 can't save to fat32 partition

In a way it seems to be a permission problem. This is the error I got (Firefox 2.0.0.3 on Edgy):

Error: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIMIMEInfo.primaryExtension]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: file:///usr/lib/firefox/components/nsHelperAppDlg.js :: anonymous :: line 238" data: no]
Source File: file:///usr/lib/firefox/components/nsHelperAppDlg.js
Line: 238

I dont know if this message is equivalent to the NS_ERROR_FILE_ACCESS_DENIED error getaceres got in https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/65164/comments/2, since he used an earlier Version of Firefox.
As it says the error is related to this piece of code in nsHelperAppdlg.js:

if (aLocalFile.isExecutable() && !this.mLauncher.targetFile.isExecutable()) {
        var f = aLocalFile.clone();
        aLocalFile.leafName = aLocalFile.leafName + "." + this.mLauncher.MIMEInfo.primaryExtension;

        f.remove(false);
        this.makeFileUnique(aLocalFile);
}

I dont quiet get the semantics of this paragraph (for example what the differnce between the two Files is and why they delete the first one), so a cannot say if its a bug or a feature ;).
As soon as the Fat32 partition is mounted with permissions rwx on files and directories, aLocalFile is always excecutable. When downloading a regular file (something not a binary executable), Firefox seems to set the mode of targetFile to 600, so
the expression is true and I get a aborted download and a 0 byte file.
Watching the network traffic revealed, that Firfox starts donwloading as soon as I left click on a link; seems it is prefetching the download while the user selects the destination. As soon as I click Ok the download stops.
Right click -> Save target as... works nicely, as nothing is prefetched and the section in nsHelperAppdlg.js is not executed, but this procedure is not possible for all downloads.

This leads to two workarounds for this problem:
1. Quick and dirty commenting out the above section in nsHelperAppdlg.js. This is not a good idea as long as the meaning of it is unclear, even though I discovered no side effects.
2. Mount the partition with separate dmask and fmask (for example dmask=007,fmask=117). As long as you dont need to execute files on that partition, this is a much cleaner solution than the first.

Of course these are just workarounds, so a real fix still needs to be done.