Debugging xdg-open

Felix Natter fnatter at gmx.net
Mon Apr 27 06:15:19 PDT 2015


Bastien Nocera <hadess at hadess.net> writes:

> 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.

> On Sat, 2015-04-25 at 12:09 +0200, Felix Natter wrote:
>> 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)
>
> 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)?

>> --> 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


More information about the xdg mailing list