Firefox does not use default application to open binary files

Bug #918019 reported by el_gallo_azul
246
This bug affects 56 people
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

This is beyond me, so I would like some help.

Up until a software update within the last few months (maybe the upgrade to Ubuntu 11.100, I can't remember), if I opened a PDF file in Firefox, it would always ask, and the default aplication for that file type was Document Viewer.

Now it defaults to 'gedit'.

I have tried (through 'Edit --> Preferences') setting my default application for PDF files to 'Document Viewer', and then downloading a PDF file to open it, but for some reason the dialog box then says 'Open with...' and 'gedit'.

I will attach screenshots of:

1. Application Preferences; and
2. Dialog box showing Open with... gedit (default).

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: firefox 9.0.1+build1-0ubuntu0.11.10.2
ProcVersionSignature: Ubuntu 3.0.0-14.23-generic 3.0.9
Uname: Linux 3.0.0-14-generic i686
AddonCompatCheckDisabled: False
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24.
AplayDevices:
 **** List of PLAYBACK Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: ALC260 Analog [ALC260 Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
ApportVersion: 1.23-0ubuntu4
Architecture: i386
ArecordDevices:
 **** List of CAPTURE Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: ALC260 Analog [ALC260 Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: el_gallo_azul 1675 F.... pulseaudio
BuildID: 20111228084953
CRDA: Error: [Errno 2] No such file or directory
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xe8a00000 irq 44'
   Mixer name : 'Realtek ALC260'
   Components : 'HDA:10ec0260,103c3011,00100400'
   Controls : 24
   Simple ctrls : 13
Channel: release
Date: Wed Jan 18 14:31:02 2012
ForcedLayersAccel: False
IfupdownConfig:
 auto lo
 iface lo inet loopback
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
IpRoute:
 default via 192.168.0.253 dev eth0 proto static
 169.254.0.0/16 dev eth0 scope link metric 1000
 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.2 metric 1
Profiles: Profile0 (Default) - LastVersion=9.0.1/20111228084953 (Running)
RfKill:
 0: phy0: Wireless LAN
  Soft blocked: no
  Hard blocked: no
RunningIncompatibleAddons: False
SourcePackage: firefox
UpgradeStatus: Upgraded to oneiric on 2011-11-13 (65 days ago)
dmi.bios.date: 05/18/2005
dmi.bios.vendor: Hewlett-Packard
dmi.bios.version: 786D1 v01.03
dmi.board.name: 09F8h
dmi.board.vendor: Hewlett-Packard
dmi.chassis.asset.tag: 43e0119
dmi.chassis.type: 4
dmi.chassis.vendor: Hewlett-Packard
dmi.modalias: dmi:bvnHewlett-Packard:bvr786D1v01.03:bd05/18/2005:svnHewlett-Packard:pnHPCompaqdc7600SmallFormFactor:pvr:rvnHewlett-Packard:rn09F8h:rvr:cvnHewlett-Packard:ct4:cvr:
dmi.product.name: HP Compaq dc7600 Small Form Factor
dmi.sys.vendor: Hewlett-Packard

Revision history for this message
el_gallo_azul (el-gallo-azul) wrote :
Revision history for this message
el_gallo_azul (el-gallo-azul) wrote :
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Please attach the mimeTypes.rdf file from your Firefox profile folder

Changed in firefox (Ubuntu):
status: New → Incomplete
Revision history for this message
el_gallo_azul (el-gallo-azul) wrote :

Here it is

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for firefox (Ubuntu) because there has been no activity for 60 days.]

Changed in firefox (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Martin Lorenz (martin-lorenz) wrote :

This behaviour is quite annoying.
It is also true for, e.g., Excel Files.

I noticed, that it occurs whenever the file is to be downloaded via a script.

here is an excample URL (taken from my local otrs installation)

http://127.0.0.1/otrs/index.pl/MITGLIED.XLS?Action=AgentTicketAttachment;ArticleID=11;FileID=3

The download dilog only offers me to open in gedit or save to disk.
The default action for application/ms-excel is "open with libreoffice calc" but in this case it is ignored.

Changed in firefox (Ubuntu):
status: Expired → Opinion
Revision history for this message
Martin Lorenz (martin-lorenz) wrote :

maybe thete is someone, who konws how to solve this?

Changed in firefox (Ubuntu):
status: Opinion → New
Revision history for this message
Martin Lorenz (martin-lorenz) wrote :
Revision history for this message
el_gallo_azul (el-gallo-azul) wrote :

Not solved yet, but thanks Martin Lorenz for your input.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in firefox (Ubuntu):
status: New → Confirmed
Revision history for this message
quequotion (quequotion) wrote :

First, let me say that I had a well thought out and informative post to add here, but the opportunity to do so was denied me by a rather nasty crash bug in the linux kernel version 3.2.0.x which has several open bugs and no available solutions.

So now I post while somewhat enraged, forgive me.

I have this issue with greater severity; firefox tries to open everything in gedit.

I have had this and similar issues before (firefox tries to open everything in totem, firefox can't find a default program to open anything in, etc)

The problem is in part design, as firefox does it's own mimetype recognition to avoid depending on the operating system's mimetype recognition.

Supposedly, firefox should be able to get the list of mime applications from the operating system and incorporate them into it's own mimetype recognition.

In my experience this has never worked 100% in linux, and is the most often broken feature of firefox.

I've learned to live with it and odds are you will have to as well.

Several people have filed bug reports over the years, with each one of them ending in dismay or a hacked out workaround but never a solution.

Most of the time the entire dicussion failed to communicate what exactly was wrong.

Good luck; I think I'm going to format my hard drives, install grub-invaders, and declare victory.

Revision history for this message
quequotion (quequotion) wrote :

Here's a hacky workaround for you:

I found a strange entry in ~/.local/share/applications/mimeapps.list

application/octet-stream=gedit.desktop;

This means open almost any kind of binary file in gedit.

Perhaps you have something similar.

Deleting that line has solved the problem for me, until next time.

There is very likely to be a next time; let me explain:

Probably, one day I asked Ubuntu to open a file that I thought was text in gedit, only to get some kind of scrambled nonsense since the file was actually binary.

My particular case aside, opening an unkown file in the wrong application is a very easy mistake to make.

Ubuntu quietly, and insidiously, saved my mistake as a mime-application override (nothing indicates that your one-time choice will become permanent).

Fortunately, this had no apparent affect on my everyday work in Ubuntu (this time, other times it has had an effect.).

How could I have known that firefox gets its half-brained ideas about what applications open what from that list of overrides.

Revision history for this message
quequotion (quequotion) wrote :

firefox's mimetype handling is still broken and incomplete, with many installed mime applications apparently unknown to it.

Revision history for this message
Conjacq (cjneeteson) wrote :

The workaround of quequotion worked for me (deleting the line on ~/.local/share/applications/mimeapps.list). I have Ubuntu 12.04 64-bit installed. I had problems in opening PDF files.

Revision history for this message
el_gallo_azul (el-gallo-azul) wrote :

Thanks Conjacq

I just deleted that line 'application/octet-stream=gedit.desktop;' in '~/.local/share/applications/mimeapps.list' and I will see what happens.

Revision history for this message
el_gallo_azul (el-gallo-azul) wrote :

and thanks quequotion for posting it in the first place.

summary: - Firefox does not use default application to open PDF files
+ Firefox does not use default application to open binary files
Revision history for this message
Ville Ranki (ville-ranki) wrote :

"me too". Firefox tries to open zip files in gedit. In Nautilus they are correctly associated to file-roller.

Removing this line seemed to fix the issue:
application/octet-stream=gedit.desktop;inkscape.desktop;

I believe the bug is NOT in Firefox, but in whatever adds the line to the mimeapps.list. It should be in sync with the file associations used by Nautilus. I don't know enough details of this mechanism to suggest the correct fix.

Revision history for this message
Seunghoon Park (pclove1) wrote :

In my case, firefox tries to open pdf file using emacs which is NOT my default viewer for pdf file.

Revision history for this message
Joshua Montee (joshua-montee) wrote :

I have been plagued by this problem for at least a year. It was a motivating factor in upgrading my system from 11.04 to 12.04, and to my dismay, the install of 12.04 worked properly for a while... then went back to opening Excel files in gedit.

Thanks a MILLION, quequotion... your suggestion fixed my problem.

Apparently this problem rears its ugly head in several ways. Like Martin Lorenz (martin-lorenz), I didn't encounter this issue in Firefox. I encountered this running both 11.04 (Gnome Classic environment) and 12.04 (Gnome fallback session environment). Specifically, when I would drill down through the Gnome panel/bar at the top, under Places, then under Recent Documents.... if I clicked an Excel (xls) file that was located on a network share, it would always open in gedit. I think I also saw this happen with Word (.doc) files, too, but I hardly ever use those.

Whenever this annoyed me enough, I tried to figure out the cause via Google... apparently today was my lucky day! Thanks again quequotion!!

Revision history for this message
Martin Lorenz (martin-lorenz) wrote : Re: [Bug 918019] Re: Firefox does not use default application to open binary files

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

So far, that I can say, the workaround did the trick.
I stll have some issues with mime-type recognition (for example links
 get opened in firefox/iceweasel by default. When it's an https-Link
epiphany will spawn instead ...)

I think the mime-type handling in Gnome/Nautilus/Firefox is
alltogether a little hacky and incomplete.
Maybe different implementations are mutually exclusive but forced to
live together … ?

That much from me.
tnx quequotion

martin

Am 09.11.2012 00:57, schrieb Joshua Montee:
> I have been plagued by this problem for at least a year. It was a
> motivating factor in upgrading my system from 11.04 to 12.04, and
> to my dismay, the install of 12.04 worked properly for a while...
> then went back to opening Excel files in gedit.
>
> Thanks a MILLION, quequotion... your suggestion fixed my problem.
>
> Apparently this problem rears its ugly head in several ways. Like
> Martin Lorenz (martin-lorenz), I didn't encounter this issue in
> Firefox. I encountered this running both 11.04 (Gnome Classic
> environment) and 12.04 (Gnome fallback session environment).
> Specifically, when I would drill down through the Gnome panel/bar
> at the top, under Places, then under Recent Documents.... if I
> clicked an Excel (xls) file that was located on a network share, it
> would always open in gedit. I think I also saw this happen with
> Word (.doc) files, too, but I hardly ever use those.
>
> Whenever this annoyed me enough, I tried to figure out the cause
> via Google... apparently today was my lucky day! Thanks again
> quequotion!!
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJQnLF1AAoJECZ8myNlGwU1YZEH/RUv7wCsqNME57gusYK3PayM
YkdLoCTGVSB6bZWh00p0+d2KRM/8O9BqjR97qXWtebBV9Z7tZIFcl4HOYeSYdARy
5UR583Nw3wGrmTLxqXe2I7Odyb8Ny/3BzN7c7gF2rAF7y+48yGVFLBWYVT4vIjxk
jO8oQGDpD9yya6wM4bBaLNvZFJnUZ+SiWtWFATSL0Ew6CA9wr+t5S2u1ksgfRAMb
h/mfpkFIGY2QOv2lzFIym9zIUB+fo1kSS0sP8zRaIpEz4EBfhM0OWYkgrQPGZUSK
mQy6mSJYYi1bE8FCOZSIW18mdurGgLLEaMt8Kw+CYzGSFdMt9Boms7RQy45ijLc=
=as1L
-----END PGP SIGNATURE-----

Revision history for this message
Christopher (soft-kristal) wrote :

The really odd part is that I'm using the same profile on a 64 bit partition and it shows no sign of the bug. Ditto my old laptop.

It makes me suspect there is something non-firefox happening.

Revision history for this message
Rudolf Leitgeb (rudolf-leitgeb) wrote :

It's been well over a year since this bug was reported and confirmed, and with Ubuntu 13.04 it's still there in its full glory. From looking through strace and wireshark logs it becomes evident that the web server reports a file as x-octetstream, and instead of using file magic to determine the actual file type firefox just picks the application listed in that obscure file .local/share/applications/mimeapps.list

All this leads me to two questions:
- which application came up with the silly idea to put gedit into that file as standard handler of all x-octetstream BLOBs?
- and why does firefox grey out the radio button that would allow me to permanently assign another application to this data type?

Revision history for this message
quequotion (quequotion) wrote :

>>Rudolf
- I susupect nautilus makes the mime-application overrride when you open a file in the wrong program, but I am not sure.
- No idea, and furthermore why is firefox's mime handling so terrible? It can't even give you a list of installed applications to choose from when this button works--you have to select the executable from somewhere in your filesystem (usually /usr/bin/ or /usr/sbin/) because it doesn't understand .desktop files.

Revision history for this message
gcb (gcb0) wrote :

comment #12 work around applied here with success.

Revision history for this message
Grzegorz G. (grzesiek1e5) wrote :

For me the file was ~/.config/mimeapps.list

Thank you for that workaround from comment 12!

Revision history for this message
Martinique (martinique) wrote :

I worked around this bug by adding a .desktop file for xdg-open and then setting it to be the default handler for unknown binary (application/octet-stream) files. It appears as "Let Ubuntu choose" in Firefox for opening files. I haven't had any problems since.

1. Put the below lines into a new file /usr/share/applications/xdg-open.desktop (using sudo)
[Desktop Entry]
Name=Let Ubuntu choose
Exec=/usr/bin/xdg-open
Terminal=false
Type=Application
NoDisplay=true

2. Edit .local/share/applications/mimeapps.list and replace this line:
application/octet-stream=gedit.desktop;
...with this:
application/octet-stream=xdg-open.desktop;

Revision history for this message
el_gallo_azul (el-gallo-azul) wrote :

Thanks Martinique. That sounds promising, so I've made the same tweaks myself.

I won't know in the short term if they have been successful, because I stopped using Firefox as my default browser more than a year ago for this and a couple of other reasons. Google Chromium is the default now.

Revision history for this message
quequotion (quequotion) wrote :

>Martinique

That's a really good idea! This could solve mime association problems across the board.

I made two slight modifications, one because I quit Ubuntu and the other is more important:

[Desktop Entry]
Name=Auto-select
Exec=/usr/bin/xdg-open %U
Terminal=false
Type=Application
NoDisplay=true

"%U" will be filled in with the filename/url to be opened.
http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

Also, as Grzegorz (#25) pointed out, there are two possible locations for (user-custom) "mimeapps.list"
~/.config/mimeapps.list
~/.local/share/applications/mimeapps.list

More information (much more):
https://wiki.archlinux.org/index.php/Default_applications#MIME_types_and_desktop_entries

Revision history for this message
quequotion (quequotion) wrote :

Perhaps add this line would also be helpful:

MimeType=application/octet-stream;

Revision history for this message
Jan Niklas Hasse (jhasse) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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