Bug#681451: gvfs-bin: gvfs-open (via xdg-open) opens pdfs in wrong application

Simon McVittie smcv at debian.org
Wed Oct 31 23:58:02 UTC 2012


On Fri, 13 Jul 2012 at 17:57:46 +0900, Norbert Preining wrote:
> I also checked with xdg-mime types, and they are set correctly:
> 
> $ xdg-mime query filetype foo.pdf
> application/pdf

xdg-mime thinks the file is an application/pdf, but I wonder whether GIO
agrees. With libglib2.0-0-dbg installed, try:

gdb --args gvfs-open foo.pdf
break get_all_desktop_entries_for_mime_type
commands 1
bt
cont
end
break g_content_type_guess
commands 2
bt
finish
cont
end
run
(If asked whether to "Make breakpoint pending", reply "y"; if you get to
a (gdb) prompt while the program is running, type "cont".)

I get these calls:

get_all_desktop_entries_for_mime_type("x-scheme-handler/file", ...)
get_all_desktop_entries_for_mime_type("x-scheme-handler/file", ...)
g_content_type_guess("foo.pdf", ...)
Value returned is $1 = (gchar *) 0x640de0 "application/pdf"
get_all_desktop_entries_for_mime_type("application/pdf", ...)

with evince presumably coming from the third; but if GIO doesn't think
the PDF is a PDF (for whatever reason), it seems reasonable to think that
Nautilus might be the fallback for x-scheme-handler/file?

Bill, you could try this too, substituting your file for foo.pdf. I suspect
your situation might be different, though.

On Sun, 12 Aug 2012 at 14:27:24 -0700, Bill Wohler wrote:
>     $ locate openoffice.org-calc.desktop
>     /usr/share/app-install/desktop/openoffice.org-calc.desktop

"locate" won't necessarily find your personal files (many implementations
index the filesystem as an unprivileged user). Try
"find ~/.local ~/.config -name openoffice.org-calc.desktop"? I suspect
you might find that you have a leftover copy of openoffice.org-calc.desktop in
~/.local/share/applications.

> I think what is happening is that /usr/share/app-install/desktop is not
> in the search path and /usr/share/applications is

This is as it should be: /usr/share/app-install/desktop contains desktop files
for applications that you don't necessarily have, but could if you installed
them, so that it can be searched for queries of the form "which Debian
packages could I install to have an application called Evince?" or, in
principle, "which Debian packages could I install to be able to open an
application/pdf?".

/usr/share/applications is the set of applications you actually have
(system-wide - you might have more in ~/.local/share/applications).

    S



More information about the pkg-gnome-maintainers mailing list