Bug 80714 - xdg-open ignores static arguments in .desktop files
Summary: xdg-open ignores static arguments in .desktop files
Status: RESOLVED MOVED
Alias: None
Product: xdgmime
Classification: Unclassified
Component: xdgmime (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Jonathan Blandford
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-30 14:25 UTC by sam.halliday
Modified: 2018-10-13 10:33 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description sam.halliday 2014-06-30 14:25:25 UTC
Observed on Ubuntu with xdg-open 1.0.2

I created a custom .desktop, placing it in ~/.local/share/applications and associated it to a few filetypes that I'm interested in.

For the sake of simplicity lets say the custom launcher is just supposed to echo the name of the file it is handed, adding a fixed parameter:

Exec: echo BOO

When I attempt to open my custom file (which is resolving the desktop correctly):

xdg-open myfile.fommil


# EXPECTED

BOO myfile.fommil


# OBSERVED

myfile.fommil


http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables says that Exec takes arguments that are space separated.


# WORKAROUND

One must create a script that takes no parameters and adds all the extra fixed parameters (e.g. a script that calls 'echo BOO $*')
Comment 1 sam.halliday 2014-06-30 14:46:14 UTC
wow, I just read the source and found out that open_generic_xdg_mime intentionally drops everything other than the first word in the Exec:

 command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"

so this behaviour is by design, and completely ignores the spec.

I guess another workaround is to install exo-open or something.
Comment 2 Gabriel Parrondo 2017-08-10 17:31:01 UTC
Just got bitten by this, took a while to figure out. Is anyone working on this? Would a patch be accepted?
Comment 3 GitLab Migration User 2018-10-13 10:33:42 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdgmime/issues/7.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.