/usr/share/applications/mimeinfo.cache is used for default applications in Firefox
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mozilla Firefox |
Confirmed
|
Unknown
|
|||
firefox (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
See https:/
With Firefox, default applications are selected by Firefox using /usr/share/
When I click on a pdf (for example), I want to have the option to open it in my default application, in my case in okular, and not in something else. However, acroread is invariably presented is presented as default choice because it happens to be the first entry in /usr/share/
This happens in spite of the fact that the desktop provides correct defaults.list and mimeapps.list files
The comments in the firefox bug seem to suggest that firefox developers are convinced that firefox calls the correct gtk libraries to determine the correct application. If this is the case, then it is necessarily the ubuntu (or possibly kubuntu) infrastructure to be failing.
ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: firefox 44.0.2+
ProcVersionSign
Uname: Linux 4.2.0-30-generic x86_64
ApportVersion: 2.19.1-0ubuntu5
Architecture: amd64
BuildID: 20160209234513
CurrentDesktop: KDE
Date: Mon Feb 29 11:37:25 2016
EcryptfsInUse: Yes
InstallationDate: Installed on 2013-12-12 (808 days ago)
InstallationMedia: Kubuntu 13.10 "Saucy Salamander" - Release amd64 (20131016.1)
SourcePackage: firefox
UpgradeStatus: Upgraded to wily on 2015-10-23 (129 days ago)
In Mozilla Bugzilla #727422, Bugzilla-tf (bugzilla-tf) wrote : | #3 |
*** Bug 727425 has been marked as a duplicate of this bug. ***
In Mozilla Bugzilla #727422, Bugzilla-tf (bugzilla-tf) wrote : | #4 |
*** Bug 568218 has been marked as a duplicate of this bug. ***
In Mozilla Bugzilla #727422, Bzbarsky (bzbarsky) wrote : | #5 |
We don't do anything with mimeinfo.cache directly. We just call into gnome-vfs using gnome_vfs_
Is that function doing the wrong thing on your machine for some reason?
In Mozilla Bugzilla #727422, dutchkind (dutchkind) wrote : | #6 |
I don't know, I don't use gnome, but some gnome libs are installed (Opensuse). But I use apparmor and when I blocked access to /usr/share/
As for finding the default app, wouldn't that be xdg-mime query default ? And if there is a need to use mimeinfo.cache, why not have all apps listed there in the dropdown list so the user can easily select? Now a user has to know which executable he needs to open something, not always easy.
In Mozilla Bugzilla #727422, ghomem (gustavo) wrote : | #7 |
I agree with Dutch Kind that this should be handled on a desktop agnostic manner like xdg-mime.
I have to add that we had this problem since at least Firefox 3.6.x on KDE.
Possible solutions in order of preference:
1. make this work in a desktop agnostic manner (via xdg)
2. use the GNOME application order in the correct way (not via the cache file)
This first solution seems better because it would be up to the distribution to ensure that xdg* works well, whereas the second one may reflect the good or bad behaviour of GNOME.
Usage examples for xdg-mime query:
[gustavo@localhost ~]$ xdg-mime query default application/pdf
AdobeReader.desktop
[gustavo@localhost ~]$ xdg-mime query default image/jpg
gwenview.desktop
[gustavo@localhost ~]
In Mozilla Bugzilla #727422, Bzbarsky (bzbarsky) wrote : | #8 |
> As for finding the default app, wouldn't that be xdg-mime query default
xdg-mime postdates the creation of this code. Bug 296443 covers using it.
Again, we're not actually using mimeinfo.cache ourselves. It's your GNOME configuration that's using it.
> Besides, before upgrading from 9 to 10 I didn't have a problem with this behavior
That's quite odd. I don't think this code changed from 9 to 10. Would you be willing to use nightly builds to find when the behavior changed for you?
> 2. use the GNOME application order in the correct way (not via the cache file)
Again, we are not doing anything with the cache file ourselves. We're just calling the official "get the app for a MIME type" GNOME APIs. First g_app_info_
http://
http://
http://
I'd like to focus on figuring out why there was a behavior change from 9 to 10 on Dutch Kind's machine here, though. _Something_ weird is going on there.
In Mozilla Bugzilla #727422, dutchkind (dutchkind) wrote : | #9 |
Maybe I first noticed the change by some update after which update-
In Mozilla Bugzilla #727422, Bzbarsky (bzbarsky) wrote : | #10 |
OK, in that case it just sounds like the real problem is we're asking GNOME for the information and your GNOME is effectively misconfigured.... Is this then effectively a duplicate of bug 296443?
In Mozilla Bugzilla #727422, ghomem (gustavo) wrote : | #11 |
It may be a GNOME problem but then it happens on at least two different distributions: Suse (cf Dutch Kind's report) and Mandriva (where I had the same problem).
Whether or not this is a duplicate of bug 296443 depends on what will be done regarding that one. If bug 296443 is to be fixed (ie, xdg is adopted) then I guess this one won't be much relevant.
In Mozilla Bugzilla #727422, Chris Coulson (chrisccoulson) wrote : | #12 |
Bug 296443 should probably be WONTFIX after bug 713802 lands
In Mozilla Bugzilla #727422, ghomem (gustavo) wrote : | #13 |
(In reply to Chris Coulson from comment #10)
> Bug 296443 should probably be WONTFIX after bug 713802 lands
But, is that good? Why tie the default associations to GNOME if we can have a desktop independent way of achieving that?
In Mozilla Bugzilla #727422, Chris Coulson (chrisccoulson) wrote : | #14 |
Using gio is a desktop independent way of doing that and isn't tied to GNOME. It's a hard dependency of gtk anyway. It implements everything we want, but it actually works (whereas xdg-mime and friends are pretty much unmaintained and are known for not being very reliable)
I'm still not sure what's causing your current problem though. This has worked fine in the past with gnomevfs
In Mozilla Bugzilla #727422, dutchkind (dutchkind) wrote : | #15 |
Ok, did some more investigations, when I copy the corresponding line containing for example pdf to $HOME/.
Still, it would be nice to use something more desktop independent. Chromium uses xdg and that works fine for me, no extra configuring, it takes my user's kde's default apps without a problem. The problem with the gnome way is that when you don't have gnome installed you have to add all the required apps to this mimeapps.list manually because KDE only writes those apps to this list that are manually changed by the user's kde configuration when this is different from the system kde default. xdg has no problems in this respect.
In Mozilla Bugzilla #727422, Mcastelluccio (mcastelluccio) wrote : | #16 |
GIO supports the shared mime specification, and so did GnomeVFS. If you run into problems with KDE, it should be a problem of KDE.
I've seen xdg-mime does some KDE specific operations.
In Mozilla Bugzilla #727422, Rion (rion4ik) wrote : | #17 |
Hi guys. I know nothing about your future GIO implementation but I hope it will support feature as in next example:
$ xdg-mime query default x-scheme-
psi-plus.desktop
and about default applications. for some reason FF does not read neither ~/.local/
xdg-open works fine though.
I checked XDG_* vars and they are correct
I love FF but chromium works much better in this regard.
In Mozilla Bugzilla #727422, urpm-tools (urpm-tools) wrote : | #18 |
It's interesting, g_app_info_
inode/
And used the following sample program:
g_type_init ();
GAppInfo *def;
def = g_app_info_
printf("EXEC: %s\n",g_
It prints "gwenview". However, FF doesn't seem to take mimeapps.list into account and uses associations from mimeinfo.cache - e.g., when I click "Open containing folder" menu item for the downloaded file, the folder is opened using Dolphin (which is the default system-wide association), not Gwenview.
I do see g_app_info_
In Mozilla Bugzilla #727422, Bzbarsky (bzbarsky) wrote : | #19 |
Denis, would you be willing to just step through the relevant Firefox code on your system and see what g_app_info_
In Mozilla Bugzilla #727422, urpm-tools (urpm-tools) wrote : | #20 |
It turns out that g_app_info_
The question is - why FF doesn't detect giovfs? I am not a gio expert, maybe something is wrong with system environment/
In Mozilla Bugzilla #727422, Bzbarsky (bzbarsky) wrote : | #21 |
You mean the do_GetService call returns null?
The most likely reason for that is that MOZ_ENABLE_GIO ends up not being defined. It looks like GIO is only enabled if the --enable-gio configure option is passed in when compiling.... See bug 713802 for why it's not defaulted on. But at least people who are compiling themselves can deal. :(
In Mozilla Bugzilla #727422, urpm-tools (urpm-tools) wrote : | #22 |
Indeed, --enable-gio solves the problem in my case, thanks a lot!
In Mozilla Bugzilla #727422, Rion (rion4ik) wrote : | #23 |
with --enable-gio everything works as expected.
I hope it will become default soon.
In Mozilla Bugzilla #727422, Jonathan Protzenko (jonathan-protzenko) wrote : | #24 |
FWIW the problem seems to have gotten worse recently; GIMP 2.8 recently landed in Debian Testing, and somehow it got prioritized over Evince for PDF documents, which means every single PDF now opens with Gimp instead of Evince. I tried to override this in Preferences > Applications, but neither "PDF File" nor "Portable Document Format" entries had any effect. I wonder how that pane is supposed to work! :)
In Mozilla Bugzilla #727422, Atrigent (atrigent) wrote : | #25 |
I've been hit by this recently, but for me the problem is that PDFs are being handled by Inkscape. My mimeinfo.cache file (the file that is being used by GIO and therefore Firefox) contains the following line:
application/
The "zzz-" thing is a hack added by my distribution - see http://
However, "xdg-mime query default application/pdf" IS alphabetical, because it does not use the mimeinfo.cache file. xdg-mime is actually a shell script, and it finds applications that support PDFs by grepping for the mime type in all of the .desktop files. The list of files passed to grep is alphabetical, so the list of files returned by grep is also alphabetical and starts with evince.desktop. Therefore, evince.desktop is what xdg-mime thinks is the default.
The core problem here is of course that there is no priority information in the .desktop files. The relevant freedesktop spec specifically forbids this - see http://
No doubt this policy was created with good intentions, but the fact is that there are legitimate reasons to encode priorities in the .desktop files. Evince should clearly have higher priority than GIMP or Inkscape for PDFs. The "the first one that I see" policy used by GIO and xdg-mime when there is no explicit user preference is always going to suck.
Adding an explicit user preference worked around the problem for me. I don't use KDE or GNOME, so I don't have access to any of the fancy graphical configuration utilities, but the following command:
xdg-mime default evince.desktop application/pdf
...seems to have been effective.
I would personally argue against using the xdg-utils in Firefox, because they are shell scripts (seriously, wtf?) and because they don't seem to be inherently smarter aside from purely by chance returning the right answer in my case.
In Mozilla Bugzilla #727422, Eevee-mozilla (eevee-mozilla) wrote : | #26 |
Having the same problem, KDE. Looks like this is GIO's fault, but also KDE's fault, but also I don't know what I'm talking about but here's what I've got.
Firefox opens PDFs in Inkscape, which is clearly insane. KDE opens them in Okular. Similarly, Firefox opens directories in Konqueror instead of Dolphin. xdg-mime gets both right:
$ xdg-mime query default application/pdf
okularApplicati
$ xdg-mime query default inode/directory
dolphin.desktop
But the first things in the mimeinfo.cache list are Firefox's (and GIO's) choices:
application/
inode/directory
Looks like xdg-mime detects if I'm running KDE and uses "ktraderclient", whatever KDE plumbing thing that is.
The difference appears to be that KDE respects an "InitialPreference" value within .desktop files -- the highest value wins. I can tell this is a KDE thing because the only files I have with such a setting are built-in KDE 4 apps. Okular is 8, Dolphin is 10. (kfmclient is also 10, so who knows what breaks the tie.) So, naturally, KDE applications will win over everything else unless otherwise specified.
GIO, of course, ignores all this nonsense entirely.
But, dearest CC list, there *is* a light at the end of the tunnel! You see, KDE *does* correctly write out user-preferred applications to ~/.local, but *only if you actually change them*. So if you want the builtin default of Okular to be your PDF reader, you can do something like this:
- Open System Settings > File Associations
- Find application/pdf
- Select Okular and move it down one space (!)
- Click Apply
- Select Okular and move it back to the top
- Click Apply again
If you don't actually make a change, KDE will cleverly assume nothing should be done, despite showing a dialog that clearly says "I'm doing things", progress bar and all.
Anyway, doing this for application/pdf and inode/directory has miraculously brought Firefox's opinion on those filetypes in line with mine, and all is well.
Not a Firefox bug, not really a GIO bug, arguably not even a KDE bug. No one caused the problem, yet the problem remains. Ah, computers. It's perhaps ironic that this was all caused by exactly the thing comment 23 proposes would fix it: priority in .desktop files.
In Mozilla Bugzilla #727422, ghomem (gustavo) wrote : | #27 |
Alex, nice contribution.
I was stated on comments 16-20 that GIO wasn't enabled on Firefox by default.
But on Ubuntu 12.04 we see after an ldd on libxul.so
libgio-2.0.so.0 => /usr/lib/
and the problem still happens. For example, directories open with Gwenview instead of Dolphin because mimeinfo.cache contains this line:
inode/directory
So in the end is this a GIO problem or a Firefox problem?
In Mozilla Bugzilla #727422, Eevee-mozilla (eevee-mozilla) wrote : | #28 |
Comments 16–20 are ancient; bug 713802, to enable GIO by default, was marked FIXED over a year ago.
tl;dr of comment 24: if you're on KDE, and Firefox isn't opening e.g. PDFs or directories with Dolphin or Okular, it's neither a Firefox nor a GIO problem. KDE supports a custom priority property in .desktop files, and built-in KDE apps have it set by default so they win out over everything else /if you haven't specified otherwise/. (Without this behavior, even KDE could start opening PDFs in Inkscape, because you never explicitly asked to use Okular. I'm not sure how GNOME et al. avoid a similar problem.) Meanwhile, GIO doesn't understand any of this because the property is non-standard.
If you manually edit your file associations, KDE *will* write out your choices in the standard way, and GIO will obey them.
In Mozilla Bugzilla #727422, ghomem (gustavo) wrote : | #29 |
Alex,
Firefox is still honoring mimeinfo.cache which is the title of this bug.
Even forgetting about any KDE specific support Firefox should honor
/usr/share/
so that a newly created user would have the system defined apps in line with his firefox settings. And a system administrador would know where to customize that on a system-wide manner.
You found a workaround that means doing things on a user-by-user basis - it is possible but brings manual work.
You say that Firefox currently uses GIO. If that is right then GIO has a bug because mimeinfo.cache should NOT be used as it lists applications in a random order and changes when packages are installed (therefore it can't be customized).
So the question is who to blame for mimeinfo.cache being used instead of defaults.list or xdg.
In Mozilla Bugzilla #727422, Eevee-mozilla (eevee-mozilla) wrote : | #30 |
Thanks a lot, now I'm reading GIO source code. :)
I removed the application/pdf line from my local mimeapps.list and added a junk entry (VLC, certainly not listed in mimeinfo.cache) to the system-wide defaults.list, and now Firefox wants to open PDFs in VLC. So as far as I can tell, this is all working correctly; the only problem *I* had was that KDE doesn't write out its initial defaults in a standard way in the first place.
If you have a defaults.list and it's not working, all I can think is that you also have another file that's overriding it, since it's checked almost-last. The ordering is:
- [Default Applications] in mimeapps.list (GNOME-specific)
- [Added Associations] in mimeapps.list
- [Removed Associations] in mimeapps.list
- defaults.list (GNOME-specific)
- mimeinfo.cache
And each of these files is consulted in order, within each of the directories ~/.local/
You might want to just put your system-wide configuration in an [Added Associations] section in /usr/share/
If you want to double-check what GIO thinks is going on without going through Firefox, a pretty easy way is to install the gobject bindings for Python (python-gobject on Ubuntu) and run:
python -c 'import gio; print gio.app_
One other (unlikely) possibility is that you have application/pdf configured as a subtype, and are being bitten by this bug, fixed after 12.04 was released: https:/
Anyway, given the above and my own experimentation, I'm reasonably sure that this is not a bug in Firefox. If anything it's a bug in freedesktop; http://
In Mozilla Bugzilla #727422, ghomem (gustavo) wrote : | #31 |
Alex,
You have a point here. After new tests on my system, based on Ubuntu 12.04 with KDE, where:
- there is a defaults.list
- there is a mimeinfo.cache
- there is NO mimeapps.list
- a new user has no specific settings on .local
it seems that defaults.list is currently honored and Firefox (GIO perhaps) falls back to mimeinfo.cache if the application defined on defaults.list does not exist on the system.
I had nautilus on defaults.list for inode/directory and Firefox was falling back to gwenview which is the first entry on mimeinfo.cache. I also tested changing the default application for PDF on defaults.list and it worked.
Can someone else confirm that defaults.list is now correctly honored?
-------
Off topic: your python one liner does not behave has expected
user@1204-IGAC:~$ python -c 'import gio; print gio.app_
[<gio.unix.
user@1204-IGAC:~$ xdg-mime query default application/pdf
okularApplicati
defaults.lst has:
application/
mimeinfo.cache has:
application/
In Mozilla Bugzilla #727422, PhobosK (phobosk) wrote : | #32 |
(In reply to Eevee (Alex Munroe) [:eevee] from comment #26)
> tl;dr of comment 24: if you're on KDE, and Firefox isn't opening e.g. PDFs
> or directories with Dolphin or Okular, it's neither a Firefox nor a GIO
> problem.
This is not exactly the case, especially considering opening directories with dolphin.
It turns out that FF (tested on 29.0.1 on Gentoo) when built with dbus support has a wrong way to do it.
It first calls (instead of checking if exists first and then calling) org.freedesktop
So for now a workaround is either to delete the /usr/share/
In Mozilla Bugzilla #727422, Fincer (fincer89) wrote : | #33 |
There is patched version of firefox available in AUR for KDE environment (Arch Linux users). It has better integration for KDE than the default and official firefox build. I compiled it with provided patches and, after all, file associations are finally as they should be in the first place - out-of-the-box, immediately. Running KDE 4.14.4.
https:/
I used to run Firefox from official Arch Package repos. File associations were just a mess at that time.
In Mozilla Bugzilla #727422, flying sheep (flying-sheep) wrote : | #34 |
TL;DR: firefox should do exactly the same as `xdg-mime query default`
----
I don’t really care how GNOME does things, and I don’t care about GIO.
If
$ xdg-mime query default application/pdf
returns
okularAppli
Then I consider my system appropriately configured to open pdf files with Okular, and firefox not respecting this is a bug.
----
To help debug this:
The above query worked like displayed even while my ~/.local/
Which probably means that something in the XDG spec other than mimeapps.list defines the order of default applications.
Firefox however opened PDFs with Inkscape.
Manually adding this line to one of the mimeapps.list files:
application
…made firefox open PDFs with Okular
Sergio Callegari (callegar) wrote : | #1 |
- Dependencies.txt Edit (5.7 KiB, text/plain; charset="utf-8")
- HookError_source_firefox.txt Edit (759 bytes, text/plain; charset="utf-8")
- JournalErrors.txt Edit (1.8 MiB, text/plain; charset="utf-8")
- ProcEnviron.txt Edit (350 bytes, text/plain; charset="utf-8")
In Mozilla Bugzilla #727422, Sergio Callegari (callegar) wrote : | #35 |
A possible workaround is:
rm /usr/share/
touch /usr/share/
chmod a-w /usr/share/
This file together with the fact that desktops/
Changed in firefox: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
In Mozilla Bugzilla #727422, Benjamin Buch (benni-buch) wrote : | #36 |
Are you going to fix this one day? The bug exists now over a decade, the internet is full of help requests and no one seems to care …
Just use xdg-mime to make it cross desktop compatible. Gnome is just one fucking desktop on Linux, but its still the only one that is supported by Firefox.
In Mozilla Bugzilla #727422, flying sheep (flying-sheep) wrote : | #37 |
Bug 568218 points out the correct files to use for this: mimeapps.list → defaults.list, as defined by the mime actions spec https:/
The “Default Applications” section says: https:/
> Indicating the default application for a given mimetype is done by writing into the group [Default Applications] in the file mimeapps.list.
> […]
> This example ensures that the application default1.desktop will be used for mimetype1, if it's installed, and otherwise default2.desktop if it's installed:
>
> [Default Applications]
> mimetype1=
In Mozilla Bugzilla #727422, Mauro (mauromol) wrote : | #38 |
Hitting this same problem in Kubuntu 20.04.
My case is this. In /usr/share/
application/
I guess the trailing ";google-
Firefox says my default PDF application is Chrome, while all the other system components (Dolphin, xdg-mime, xdg-open) correctly say that my default is Okular.
After editing /usr/share/
Strange enough, I don't have Evince installed, but many other file types are associated with Evince in that defaults.list file. I guess Evince is ignored because it is not installed. On the contrary, Chrome is installed and so it's honored by Firefox, but in this case it's skipping and ignoring my actual system settings for PDF file association.
So, there must be some problem here.
In Mozilla Bugzilla #727422, Graham Perrin (grahamperrin-gmail) wrote : | #39 |
(In reply to Boris Zbarsky [:bzbarsky] from comment #6)
> … xdg-mime … Bug 296443 …
See also: bug 724461, bug 893799, bug 1304650, …
Changed in firefox: | |
importance: | Medium → Unknown |
In Mozilla Bugzilla #727422, Release-mgmt-account-bot (release-mgmt-account-bot) wrote : | #40 |
The severity field for this bug is relatively low, S3. However, the bug has 14 votes.
:Gijs, could you consider increasing the bug severity?
For more information, please visit [auto_nag documentation](https:/
In Mozilla Bugzilla #727422, Autonag-nomail-bot (autonag-nomail-bot) wrote : | #41 |
The last needinfo from me was triggered in error by recent activity on the bug. I'm clearing the needinfo since this is a very old bug and I don't know if it's still relevant.
In Mozilla Bugzilla #727422, Brent Spillner (spillner) wrote : | #42 |
It is still relevant; see for example https:/
You could argue that this is a desktop environment bug, but from the user perspective "the right thing" happens when they open the downloaded item via their file browser of choice, and changing the default file association in their desktop environment settings tool doesn't influence Firefox behavior. Firefox is the outlier, and ought to be using the same handler application that xdg-mime would return.
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1
Build ID: 2012020800
Steps to reproduce:
With Firefox 10, and possibly before, default applications are selected by Firefox using /usr/share/ applications/ mimeinfo. cache, however, this list is a system generated list in random order and therefor does not reflect the user's preferences of which application should be used to open a file.
Actual results:
When I click on a pdf (for example), I want to have the option to open it in my default application, in my case in okular, and not in gimp. However, gimp is presented as the only choice because it happens to be the first in the row in /usr/share/ applications/ mimeinfo. cache. Selecting an other application is not very user friendly.
Expected results:
Instead of using the system wide cache Firefox should use $HOME/. local/share/ applications/ defaults. list or $HOME/. local/share/ applications/ mimeapps. list to honor the user's preferences, and if nothing is found there, then /usr/share/ applications/ defaults. list should be used instead of /usr/share/ applications/ mimeinfo. cache