MASTER Firefox 2 can't save to fat32/ntfs partitions (e.g. usb memory stick) - results in empty file

Bug #65164 reported by getaceres on 2006-10-10
66
Affects Status Importance Assigned to Milestone
Mozilla Firefox
Fix Released
Medium
firefox (Ubuntu)
Medium
Alexander Sack

Bug Description

Binary package hint: firefox

Hello, I've installed Edgy and trying to download something from Firefox to a mounted fat32 partition fails. The file is created but the size is 0 bytes. Using flashgot to bypass it (through Kget) I can download successfully the file.
It happens with Firefox 2.0 rc2 too.

Related branches

getaceres (getaceres) on 2006-10-10
description: updated
Daniel Robitaille (robitaille) wrote :

I cannot reproduce this. Downloading something from firefox on a fat32 partition works fine for me using the latest firefox available in Edgy (1.99+2.0rc2+dfsg-0ubuntu1).

getaceres (getaceres) wrote :

Tried with 1.99+2.0rc2+dfsg-0ubuntu1 and it's still the same.
Starting firefox from a console and trying to download http://www.mozilla.com/products/download.html?product=firefox-1.5.0.7&os=linux&lang=es-ES to a FAT32 partition I get the following output:

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

** Message: plugin_get_value 1 (1)

** Message: plugin_get_value 2 (2)

FG: isPreferred(application/x-gzip,[object Object])
FG: _shouldIntercept(application/x-gzip)
*** exception in validateLeafName: [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.create]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)" location: "JS frame :: file:///usr/lib/firefox/components/nsHelperAppDlg.js :: anonymous :: line 276" data: no]

Saving to my home works.

This is my /etc/fstab:

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/hda6
UUID=9e9384a1-88b2-4bda-b69e-66aa63383526 / xfs defaults 0 1
# /dev/hda2
UUID=b3fb2b98-588f-4070-ad99-a838d790a60a /boot ext3 defaults 0 2
# /dev/hdb2
UUID=8660-ED06 /media/Juegos vfat defaults,utf8,umask=007,gid=46 0 0
# /dev/hdb1
UUID=4330-75E7 /media/Seguridad vfat defaults,utf8,umask=007,gid=46 0 0
# /dev/hda1
UUID=4400404500404062 /media/Windows ntfs defaults,nls=utf8,umask=007,gid=46 0 0
# /dev/hda5
UUID=5a440573-3446-4af8-bcc0-b05c24f99bc3 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/hdd /media/cdrom1 udf,iso9660 user,noauto 0 0
/dev/ /media/floppy0 auto rw,user,noauto 0 0

getaceres (getaceres) wrote :

Tried with FF 2.0rc3 and uninstalling all of the extensions I had. It's still the same. When I download to my root partition it goes well, but downloading to a FAT32 partition (/media/Seguridad) leaves the downloaded file with 0 bytes.

getaceres (getaceres) wrote :

It happens with firefox 2.0 final too.

Patrik Rydberg (patrik-rydberg) wrote :

I can say that the same happens with firefox (default edgy version) when saving to a ntfs partition mounted with ntfs-3g. So this is not an fat32 only bug. Though when saving to /home everything works fine.

wrongman (wrongman666) wrote :

same problem. tried both ntfs-g3 and fat32, saves file with 0 bytes, console error is:
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

Changed in firefox:
assignee: nobody → mozillateam
John Vivirito (gnomefreak) wrote :

Patrik Rydberg if this is still a problem please file a new bug report on launchpad. Can anyone else reproduce this? I cant test i have no windows partition.

Changed in firefox:
status: Unconfirmed → Needs Info
Patrik Rydberg (patrik-rydberg) wrote :

I can't reproduce it myself anmore, it seems the bug has been fixed in some way, at least for ntfs partitions (I don't have any fat32 partition to test it on).
Thanks!

Alex Latchford (alex.latchford) wrote :

Hmm, I have both NTFS and FAT32 partitions, I can save successfully to both.

Thanks, Alex.

Changed in firefox:
importance: Undecided → Medium
getaceres (getaceres) wrote :

I still have the same problem. When saving to fat32 partition it creates a 0 bytes file and doesn't download anything to it.

John Vivirito (gnomefreak) wrote :

I could be reading that error wrong but it looks like you dont have correct permissions to save to your fat32 partition are you doing it as root/sudo?

getaceres (getaceres) wrote :

I don't think so. I'm running firefox as user as it's configured by default with Ubuntu. I can copy, create and delete files from firefox. Also, I can save files directly in Konqueror. Firefox seems to be the only application having problems with that partition.

getaceres (getaceres) wrote :

Sorry, when I said "I can copy, create and delete files from firefox." I had said "I can copy, create and delete files from nautilus"

David Farning (dfarning) on 2007-02-24
Changed in firefox:
assignee: mozillateam → mozilla-bugs
John Vivirito (gnomefreak) wrote :

getaceres are you saying that it works fine in nautilus and doesnt work in firefox? Is this a problem with the latest version in repos?

getaceres (getaceres) wrote :

I'm saying that it works well in every other application except firefox, so I think it's related to firefox. As a user, I can write in the fat32 partition in all the applications (konqueror, nautilus, kget, gaim, amarok, even amule and azureus) but not with firefox. It can write because it creates an empty file but instead of filling it, the download ends immediatly and the file is left with a size of 0 bytes.
I'm using the latest version and it's still the same. It's happening since the first time I installed Edgy (it was in beta at the time). It didn't happen with Dapper and I haven't tested Edgy yet.
I have tried disabling and uninstalling all the extensions, even deleting the .mozilla directory and it still happens.

getaceres (getaceres) wrote :

Today I've installed Feisty Herd5 deleting my old Edgy install and I've updated all the packages to the current version. Still I can't save to my FAT32 partitions.

claudias (szaboclaudia) wrote :

I also have the same problem: firefox is saving 0 bytes files on fat32, but works perfectly when saving in home folder.
Tried as root (as in sudo -H firefox) and it saves in the home folder, but not on fat32. So now what? :)

Fibonacci (fibonacci-prower) wrote :

Same here. Saving to (ext3) root partition works fine, saving to a FAT32 always leaves me a zero-byte file. And it's not a permissions problem, for I can move the file from ext3 to FAT32 afterwards.

Stefan Rehm (stefan-rehm) wrote :

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.

On Thu, Apr 12, 2007 at 12:15:10PM -0000, Stefan Rehm wrote:
> In a way it seems to be a permission problem. This is the error I got
> (Firefox 2.0.0.3 on Edgy):

Wow, thanks Stefan for your detailed analysis. Now I have no choice
other than to look into this :).

 - Alexander

... moving forward

Changed in firefox:
assignee: mozilla-bugs → asac
status: Needs Info → In Progress
schneeland (schneeland) wrote :

This error occurs with NTFS (ntfs3g) and Feisty (Firefox 2.0.0.3), too (see my bug https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/105474). I worked around it with solution 2 from above.

mauricio.kanno (mpkjor) wrote :

I have the problem too. I tested about permissions, but it's not the
problem. The problem is with Firefox. I tested with other browser, such
Epiphany, and it was ok.

The problem: cannot save when i put the ftp address directly in the
browser, such http://www.lidec.futuro.usp.br/envio/animagimp.pdf

Cannot save as well when I try to save files from e-mails, for example
Gmail.

The problem does not occur when I firstly open the file with other program, such adobe reader, and then save the file.

If I click directly in a link with right button, and I choose to save, it's ok.

Also, the problem does not occur when I save in my home directory. The problem is for FAT particion.

I hope this way you have enough information.

mauricio.kanno (mpkjor) wrote :

... (again here only to choose option E-mail me about changes to this bug report)...

On Tue, Apr 24, 2007 at 06:54:12PM -0000, mauricio.kanno wrote:
> ... (again here only to choose option E-mail me about changes to this
> bug report)...
>

This bug has a workaround in the comments ... can you confirm that
this fixes the problem for you too?

 - Alexander

getaceres (getaceres) wrote :

I tried commenting

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);
}

and it works. Now I can download files to my FAT32 partition but I don't know what side-effects this could have

On Wed, Apr 25, 2007 at 06:34:21AM -0000, getaceres wrote:
> I tried commenting
>
> 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);
> }
>
> and it works. Now I can download files to my FAT32 partition but I don't
> know what side-effects this could have
>

If you want to help, please make it platform dependent, e.g. by
surrending it with

#ifndef XP_UNIX
...
#endif

and attach the diff so i can include this and push this to vanilla fox
as well.

Thanks,

 - Alexander

mauricio.kanno (mpkjor) wrote :

well, alexander, as i´m not a expertise in linux, i think i´ll wait until a real fix... i don´t know even where is nsHelperAppdlg.js...

thanks

Alexander Sack (asac) wrote :

On Wed, Apr 25, 2007 at 01:32:04PM -0000, mauricio.kanno wrote:
> well, alexander, as i´m not a expertise in linux, i think i´ll wait
> until a real fix... i don´t know even where is nsHelperAppdlg.js...
>
> thanks
>

The request was not for your, but for the contributor who proposed a
fix :).

 - Alexander

Pierre Buard (pierre-buard) wrote :

After commenting the portion of code described above, not only did it solve the 0 byte files problem (on FAT32) but also the doubling of files extensions.
For every file I downloaded, an extension was added after the save dialog. This led to files being named ".zip.zip" which apart from being funny was harmless. Unfortunately, other files (rar, exe, ...) obtained a ".bin" and tar.bz2 / tar.gz received another ".tar".
At least this little problem taught me that I should pay closer attention to debug messages :-)

Alexander Sack (asac) wrote :

Pierre, in what firefox version do you still see the extension duplication (e.g. without commenting out the code mentioned inhttps://bugs.launchpad.net/ubuntu/+source/firefox/+bug/65164/comments/27)

Pierre Buard (pierre-buard) wrote :

2007/6/7, Alexander Sack <email address hidden>:
>
> Pierre, in what firefox version do you still see the extension
> duplication (e.g. without commenting out the code mentioned
>
> inhttps://bugs.launchpad.net/ubuntu/+source/firefox/+bug/65164/comments/27)

In all the 2.0 to date (including 2.0.0.4). And before you ask, I already
tried to delete my profile but the problem persists.

Changed in firefox:
status: Unknown → Confirmed
Alexander Sack (asac) wrote :

i attached a patch in upstream bug. Lets see if they are happy. Then we can apply.

Changed in firefox:
status: Confirmed → In Progress
Alexander Sack (asac) wrote :

firefox (2.0.0.4+2-0ubuntu3) gutsy; urgency=low

  * drop more patches:
    * debian/patches/ubuntu-look-and-feel-patch.patch: drop patch removes
      File->Import dialog (LP: #28563)
    * debian/patches/series: drop ubuntu-look-and-feel-geometries.patch
      from patch series; remove that patch-file from debian/patches dir
      accordingly
  * debian/control: firefox recommends ubufox - the ubuntu firefox extension
  * drop config tweaks from patchset as they are now shipped in
    ubufox extension:
    * debian/patches/disable-default-setting-for-app.update.enabled-and-app.update.auto.patch,
      debian/patches/enable-kerberos-for-https.patch,
      debian/patches/locale-my-matchOS.patch,
      debian/patches/ubuntu-disable-default-browser-check.patch,
      debian/patches/use-intl.properties.patch: drop property only
      patches from patchset
    * debian/patches/ubuntu-no-nss-chk-create.patch: drop useless patch
      as we are now using system nss.
    * debian/patches/series: remove property only patches above from
      series file as well.
    * debian/patches/ubuntu-disable-welcome-update-url.patch,
      debian/patches/ubuntu-look-and-feel-disable-help-translate-menu.patch,
      debian/patches/ubuntu-look-and-feel-patch-fix-bookmarks-ubuntu-urls.patch,
      debian/patches/ubuntu-look-and-feel-patch.patch,
      debian/patches/ubuntu-look-and-feel-report-a-bug-menuitem.patch,
      debian/patches/ubuntu-printing-patch.patch: drop property parts
      and add TODO for patches that contain tweakings that can be
      moved to distro mods extension by overlays or other tricks.
    * debian/patches/no-have-stdint-h-ftbfs.patch: drop unused trunk
      patch from release branch package.
  * debian/build-tools/obscure.c, debian/rules: provide C helper
    (obscure-tool) to obscure firefox.cfg; build this helper in rules on
    pre-build:: and clean up on clean::
  * debian/firefox-dev.install: ship obscure-tool binary in pkglibdir of
    firefox-dev package.
  * Obscure firefox.cfg:
    - debian/firefox.cfg renamed to debian/firefox.cfg.source
    - debian/rules: produce obscured debian/firefox.cfg in pre-build:: and
      remove it in clean::" debian/rules debian/firefox.cfg.source
    - debian/firefox.cfg.source: don't tweak obscure_value anymore
  * debian/patches/bz270159-lp65164-empty-file-or-duplicate-extension-on-fat32-ntfs,
    debian/patches/series: added patch for bugzilla bug bz270159 "Download
    manager adds extension regardless of file's own extension" and bugzilla
    bug bz336113 "empty file saving on download (NTFS/FAT/SMB)" - patch
    submitted to bugzilla (LP: #65164).
  * debian/firefox.links: install compatibility links for libnspr4 and
    libnss3 shared libraries. This is done because our libnss and libnspr libs
    don't have same library name as upstream ones (e.g. we use versioned soname);
    so now we install links with original filename to pkglibdir of each mozilla
    application.

  [ Andrea Veri ]
  * Added svedish translations support to firefox's .desktop file.
    (LP: #107683)

 -- Alexander Sack <email address hidden> Fri, 8 Jun 2007 01:11:00 +0200

Changed in firefox:
status: In Progress → Fix Released
Changed in firefox:
status: In Progress → Fix Released
Erunestian (raffael-c) wrote :

Yes, I have the exact same problem when I'm trying to save a file to a windows ntfs partition with Firefox in Fedora Core 8. I'm logged in as root, and I can do everything on that partition with other programs, only firefox makes a 0 bytes file.

Hi all,
  Something to cheer I hope.

I too have the same issue with file being saved as empty file. Surprisingly it is not only Firefox. Even Microsoft Word on Wine couldn't save/ saved a document with 0 bytes. It can be concluded that this may be an OS issue.

Now I am able to save/ download files on/ to NTFS with no issues at all

I edited etc/fstab and added the lines

/dev/sda1 /media/VOL_1 ntfs defaults,utf8,quiet,uid=root,gid=root,dmask=0022,fmask=0133 0 0
/dev/sda5 /media/VOL_2 ntfs defaults,utf8,quiet,uid=root,gid=root,dmask=0022,fmask=0133 0 0
/dev/sda6 /media/VOL_3 ntfs defaults,utf8,quiet,uid=root,gid=root,dmask=0022,fmask=0133 0 0
/dev/sda7 /media/VOL_4 ntfs defaults,utf8,quiet,uid=root,gid=root,dmask=0022,fmask=0133 0 0

The above is for my hda. One can get the above info by 'fdisk -l' and add appropriate entries.

I guess the issue may be with the HAL daemon. It tries to detect these partitions but not able to give write permissions to applications on them.

John Vivirito (gnomefreak) wrote :

Ragavendra,
Please open a bug report against HAl if you are still seeing this issue, if firefox problem as gone away and you are seeing it in other packages

Xavi (xavidp) wrote :

similar problem I'm having using ubuntu karmic beta, firefox 3.5 (shiretoko 3.5.4pre).
I can't download files to ntfs disk from firefox, but I can (the same file) with wget from a terminal on the same disk)

and this is the line for the partition where I attempt to save the file from firefox
# /dev/sda5 ntfscomu
LABEL=ntfscomu /mnt/ntfscomu ntfs-3g auto,users,uid=1000,gid=100,utf8,dmask=0022,fmask=0133 0 1

Any hint appreciated

Changed in firefox:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.