Bug 4461 - gio does not return the default application chosen by the user
Summary: gio does not return the default application chosen by the user
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: GNOME maintainers
QA Contact:
URL:
Whiteboard:
Keywords: UPSTREAM
Depends on:
Blocks: 2027
  Show dependency treegraph
 
Reported: 2012-02-10 00:27 CET by Luc Menut
Modified: 2022-03-17 10:29 CET (History)
6 users (show)

See Also:
Source RPM: glib2.0-2.31.16-1.mga2.src.rpm
CVE:
Status comment:


Attachments
my ~/.local/share/applications/mimeapps.list (199 bytes, text/plain)
2012-02-10 00:34 CET, Luc Menut
Details

Description Luc Menut 2012-02-10 00:27:03 CET
Description of problem:
eg. if I choose to use okular to view pdf files in systemsettings (kde 4), firefox, thunderbird or epiphany still uses evince by default to read pdf.
(this works fine in mga 1)
IIRC the module used to determine default application in gtk apps is gio, but I'm not sure.


Version-Release number of selected component (if applicable):
lib64gio2.0_0-2.31.16-1.mga2
firefox-10.0-2.mga2
thunderbird-10.0-1.mga2
epiphany-3.3.5-1.mga2

How reproducible:
always

Steps to Reproduce:
1. in kde 4 System Settings/File Associations, choose a default application for pdf files e.g. okular (not evince),
2. try to open a pdf file from firefox
   e.g. http://cran.r-project.org/doc/contrib/Paradis-rdebuts_fr.pdf
3. result: evince is used by default even if you have explicitly chosen okular as pdf reader.
Comment 1 Luc Menut 2012-02-10 00:34:09 CET
Created attachment 1517 [details]
my ~/.local/share/applications/mimeapps.list

kde4-okularApplication_pdf.desktop is the first application for application/pdf, so okular should be used by default to view pdf files
cf. freedesktop.org mime-actions-spec specifications / User-specified application ordering http://www.freedesktop.org/wiki/Specifications/mime-actions-spec
Comment 2 Manuel Hiebel 2012-02-11 00:29:07 CET
Any ideas guys ?

CC: (none) => balcaen.john, dmorganec, doktor5000, fundawang

Comment 3 Florian Hubold 2012-02-12 01:49:41 CET
On a fresh profile in cauldron, the only "Applications" firefox knows are protocols, like mailto, irc, webcal, and SWF files. Only thing i could find upstream was https://developer.mozilla.org/en/How_Mozilla_determines_MIME_Types#File_URIs and https://developer.mozilla.org/en/Document_Loading_-_From_Load_Start_to_Finding_a_Handler

In fact, it does not list any MIME type, unlike in Mageia 1.
Comment 4 Florian Hubold 2012-02-12 17:29:58 CET
One of the developers pointed me to the relevant code, or at least parts of it:
http://mxr.mozilla.org/mozilla-central/source/uriloader/exthandler/unix/nsOSHelperAppService.h#44
and
http://mxr.mozilla.org/mozilla-central/source/uriloader/exthandler/unix/nsOSHelperAppService.cpp#1382

This is what the shipped default mimetypes.rdf looks like (it's empty):
http://mxr.mozilla.org/mozilla-central/source/browser/locales/generic/profile/mimeTypes.rdf

I'm currently in touch with some developers who have definitve in-depth information about this, because either mozillazine nor developer.mozilla.org has useful information, as far as i have looked.
Comment 5 Florian Hubold 2012-02-12 17:39:28 CET
Under linux they are asking GNOME:

http://mxr.mozilla.org/mozilla-central/source/uriloader/exthandler/unix/nsGNOMERegistry.cpp

Now it's time for the coders to take a look :)
Comment 6 Luc Menut 2012-02-12 18:02:33 CET
The bug isn't in mozilla apps (the same code works fine in mga1, epiphany doesn't works), but in the underlying gnome's library (probably gio) used to query the default application for a given mime-type (cf bugreport title).
Comment 7 Luc Menut 2012-02-12 19:41:28 CET
I reported this bug upstream, because I reproduced it with Opensuse 12.1 KDE4 LiceCD.
https://bugzilla.gnome.org/show_bug.cgi?id=669936

Keywords: (none) => UPSTREAM
See Also: (none) => https://bugzilla.gnome.org/show_bug.cgi?id=669936

Comment 8 Dave Hodgins 2012-02-12 21:42:53 CET
See https://bugs.mageia.org/show_bug.cgi?id=2051#c7

CC: (none) => davidwhodgins

Comment 9 Marja Van Waes 2012-05-26 13:10:30 CEST
Hi,

This bug was filed against cauldron, but we do not have cauldron at the moment.

Please report whether this bug is still valid for Mageia 2.

Thanks :)

Cheers,
marja

Keywords: (none) => NEEDINFO

Florian Hubold 2012-06-15 20:47:38 CEST

Blocks: (none) => 2027
Keywords: NEEDINFO => (none)

Comment 10 Florian Hubold 2014-08-24 17:39:15 CEST
(In reply to Luc Menut from comment #7)
> I reported this bug upstream, because I reproduced it with Opensuse 12.1
> KDE4 LiceCD.
> https://bugzilla.gnome.org/show_bug.cgi?id=669936

Your upstream report was closed as RESOLVED NOTGNOME - and it was referred to upstream definition of mime-actions - http://freedesktop.org/wiki/Specifications/mime-actions-spec which doesn't seem to exist anymore. This is it:
https://web.archive.org/web/20140323171954/http://freedesktop.org/wiki/Specifications/mime-actions-spec/

Anyways, the key seems to be this: https://bugzilla.gnome.org/show_bug.cgi?id=669936#c2 This whole stuff still seems totally bonkers. A quick check for PDF with xdg-mime and gvfs-mime:


[doktor5000@Mageia4 ~]$ xdg-mime query filetype malsha1.pdf
application/pdf
[doktor5000@Mageia4 ~]$ xdg-mime query default application/pdf
okularApplication_pdf.desktop
[doktor5000@Mageia4 ~]$ LC_ALL=C gvfs-mime --query application/pdf
Default application for 'application/pdf': evince.desktop
Registered applications:
        evince.desktop
        kde4-okularApplication_pdf.desktop
        inkscape.desktop
        evince-previewer.desktop
        gimp.desktop
        calibre-ebook-viewer.desktop
        calibre-gui.desktop
        epdfview.desktop
        atril.desktop
Recommended applications:
        evince.desktop
        kde4-okularApplication_pdf.desktop
        inkscape.desktop
        evince-previewer.desktop
        gimp.desktop
        calibre-ebook-viewer.desktop
        calibre-gui.desktop
        epdfview.desktop
        atril.desktop

xdg-mime is OK, gvfs-mime 

So what do we do about this bug?
Comment 11 Florian Hubold 2014-10-23 13:42:21 CEST
More bonkers, applies to default Mageia installation, probably also for mga5. When trying to open a .patch from some GTK application (e.g. Thunderbird) it will open in ... notepad run via wine.


ââ[doktor5000@Mageia4]â[13:06:04]â[~]
ââââ¼ LC_ALL=C xdg-mime query default text/x-patch
kate.desktop
ââ[doktor5000@Mageia4]â[13:06:09]â[~]
ââââ¼ LC_ALL=C gvfs-mime --query text/x-patch
Default application for 'text/x-patch': wine-extension-txt.desktop
Registered applications:
        wine-extension-txt.desktop
        wine-extension-pyw.desktop
        juffed.desktop
        pluma.desktop
        calibre-ebook-viewer.desktop
        calibre-gui.desktop
        libreoffice-writer.desktop
        kde4-kwrite.desktop
        kde4-okularApplication_txt.desktop
        kde4-kate.desktop
        mousepad.desktop
        emacs.desktop
        leafpad.desktop
No recommended applications


Setting it explicitly via xdg-mime set default:


ââ[doktor5000@Mageia4]â[13:06:14]â[~]
ââââ¼ browser="kate.desktop"
ââ[doktor5000@Mageia4]â[13:06:36]â[~]
ââââ¼ xdg-mime default $browser text/x-patch
ââ[doktor5000@Mageia4]â[13:07:01]â[~]
ââââ¼ LC_ALL=C xdg-mime query default text/x-patch
kate.desktop

gvfs-mime still doesn't care:

ââ[doktor5000@Mageia4]â[13:07:06]â[~]
ââââ¼ LC_ALL=C gvfs-mime --query text/x-patch
Default application for 'text/x-patch': wine-extension-txt.desktop
Registered applications:
        wine-extension-txt.desktop
        wine-extension-pyw.desktop
        juffed.desktop
        pluma.desktop
        calibre-ebook-viewer.desktop
        calibre-gui.desktop
        libreoffice-writer.desktop
        kde4-kwrite.desktop
        kde4-okularApplication_txt.desktop                                                                                                                              
        kde4-kate.desktop                                                                                                                                               
        mousepad.desktop                                                                                                                                                
        emacs.desktop                                                                                                                                                   
        leafpad.desktop
No recommended applications


You have to set it to kde4-kate.desktop - I believe that gvfs-mime makes this name up, as there's no desktop file of that name, and also no such definitions in ~/.local/share/applications. gvfs-mime is simply wrong there and should be shot^Wfixed.

ââ[â]â[doktor5000@Mageia4]â[13:12:13]â[~]
ââââ¼ LC_ALL=C gvfs-mime --set text/x-patch kde4-kate.desktop
Set kde4-kate.desktop as the default for text/x-patch
ââ[doktor5000@Mageia4]â[13:12:55]â[~]
ââââ¼ LC_ALL=C gvfs-mime --query text/x-patch
Default application for 'text/x-patch': kde4-kate.desktop
Registered applications:
        kde4-kate.desktop
        wine-extension-txt.desktop
        wine-extension-pyw.desktop
        juffed.desktop
        pluma.desktop
        calibre-ebook-viewer.desktop
        calibre-gui.desktop
        libreoffice-writer.desktop
        kde4-kwrite.desktop
        kde4-okularApplication_txt.desktop
        mousepad.desktop
        emacs.desktop
        leafpad.desktop
Recommended applications:
        kde4-kate.desktop


I cannot even see where the wine entries stem from.
Comment 12 Samuel Verschelde 2016-10-11 22:29:11 CEST
Assigning to Gnome maintainer group.

Assignee: bugsquad => gnome

Comment 13 Rémi Verschelde 2022-03-17 10:29:23 CET
Still valid in current Cauldron, and I've been seeing it ever since Mageia was created. This is really annoying when Firefox starts using Internet Explorer through WINE to open images or PDFs on KDE...

CC: (none) => rverschelde


Note You need to log in before you can comment on or make changes to this bug.