Discussion:
Debugging xdg-open
Felix Natter
2015-04-25 10:09:34 UTC
Permalink
hello,

I am the author of a "freeplane" debian package, and the problem is that
for a user, it runs successfully from a terminal, but not from a file
manager (rightclick->run_as I think).

Now I would like to debug this (possibly using xdg-open):

- $ file bugreports.mm
bugreports.mm: Freeplane document

- $ xdg-open bugreports.mm
Opening "bugreports.mm" with LibreOffice Writer (text/x-troff-mm)
(even though Freeplane is listed first in right-click dialog in
nautilus)

--> Is there another way to debug this? Will "Terminal=true" in a
desktop file work? Do I need to run a command after I modify
/usr/share/applications/freeplane.desktop?

Thanks and Best Regards,
--
Felix Natter
Felix Natter
2015-04-25 11:02:33 UTC
Permalink
Post by Felix Natter
hello,
I am the author of a "freeplane" debian package, and the problem is that
for a user, it runs successfully from a terminal, but not from a file
manager (rightclick->run_as I think).
- $ file bugreports.mm
bugreports.mm: Freeplane document
- $ xdg-open bugreports.mm
Opening "bugreports.mm" with LibreOffice Writer (text/x-troff-mm)
(even though Freeplane is listed first in right-click dialog in
nautilus)
--> Is there another way to debug this? Will "Terminal=true" in a
desktop file work? Do I need to run a command after I modify
/usr/share/applications/freeplane.desktop?
I received feedback from the user. Strangely it works when starting
from xdg-open. Can I do one of the following?

Exec=/usr/bin/freeplane > /tmp/out.log 2>&1
Exec=bash -c "/usr/bin/freeplane" > /tmp/out.log 2>&1
Exec=bash -c "/usr/bin/freeplane > /tmp/out.log 2>&1"

Thanks and Best Regards,
--
Felix Natter
Bastien Nocera
2015-04-25 12:27:40 UTC
Permalink
Hey,
Post by Felix Natter
hello,
I am the author of a "freeplane" debian package, and the problem is that
for a user, it runs successfully from a terminal, but not from a file
manager (rightclick->run_as I think).
- $ file bugreports.mm
bugreports.mm: Freeplane document
- $ xdg-open bugreports.mm
Opening "bugreports.mm" with LibreOffice Writer (text/x-troff-mm)
(even though Freeplane is listed first in right-click dialog in
nautilus)
It's likely that whatever xdg-open uses to check the mime-type doesn't
check the magic of the file, and falls back to using the suffix.
Post by Felix Natter
--> Is there another way to debug this? Will "Terminal=true" in a
desktop file work? Do I need to run a command after I modify
/usr/share/applications/freeplane.desktop?
sh -x xdg-open bugreports.mm
will show you what actual command it's using to detect the mime-type,
which is desktop dependent.

Cheers
Felix Natter
2015-04-27 13:15:19 UTC
Permalink
Post by Bastien Nocera
Hey,
hello Bastien,

thanks for the quick reply. The problem in this case was that
JAVA_HOME was set in a place so that it does not work with
bash -c /usr/bin/freeplane
but it works with
bash -i -c /usr/bin/freeplane

(although the user has placed the export in both ~/.bashrc and
~/.profile...)

--> but this problem probably belongs to a general UNIX mailing list.
Post by Bastien Nocera
Post by Felix Natter
hello,
I am the author of a "freeplane" debian package, and the problem is that
for a user, it runs successfully from a terminal, but not from a file
manager (rightclick->run_as I think).
- $ file bugreports.mm
bugreports.mm: Freeplane document
- $ xdg-open bugreports.mm
Opening "bugreports.mm" with LibreOffice Writer (text/x-troff-mm)
(even though Freeplane is listed first in right-click dialog in
nautilus)
It's likely that whatever xdg-open uses to check the mime-type doesn't
check the magic of the file, and falls back to using the suffix.
I guess you are right, it uses the ending and somehow decides
that it's troff-mm (whatever that is).

$ file bugreports.mm
bugreports.mm: Freeplane document

$ xdg-open bugreports.mm
Opening "bugreports.mm" with LibreOffice Writer (text/x-troff-mm)

/usr/share/mime/packages/freeplane.xml:
http://paste.debian.net/169322/
--> this uses the magic present in the file:
<map version="freeplane 1.2.0">

Is there a way to make xdg-open behave like "nautilus run_as"
(this actually chooses freeplane based on magic above)?
Post by Bastien Nocera
Post by Felix Natter
--> Is there another way to debug this? Will "Terminal=true" in a
desktop file work? Do I need to run a command after I modify
/usr/share/applications/freeplane.desktop?
sh -x xdg-open bugreports.mm
will show you what actual command it's using to detect the mime-type,
which is desktop dependent.
$ sh -x xdg-open bugreports.mm
sh: 0: Can't open xdg-open

Thanks and Best Regards,
--
Felix Natter
Loading...