Bug 92170 - xdg-settings assumes desktop files have exactly one Exec line
Summary: xdg-settings assumes desktop files have exactly one Exec line
Status: RESOLVED MOVED
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-28 22:23 UTC by Chad MILLER
Modified: 2019-02-16 13:36 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
desktopfile/binary mapping works for multi-Exec destop files (3.31 KB, patch)
2015-09-28 22:30 UTC, Chad MILLER
Details | Splinter Review

Description Chad MILLER 2015-09-28 22:23:42 UTC
Example command:

xdg-settings set default-web-browser chromium-browser.desktop


In searching the desktop file for suitability, it scans for all lines that begin "Exec", and takes the result and packs it into a variable.

If there is exactly one Exec line, this takes out a command name to test for existence, but when more than one matches, the program name is captured as "firstexecprog\nsecondexecprog\nthirdexecprog", and "which" doesn't know how to look up a program like that and the subsequent tests fail.

Output with sh's "-x" option on:


+ grep -E ^Exec(\[[^]=]*])?= /usr/share//applications/chromium-browser.desktop
+ command=chromium-browser
chromium-browser
chromium-browser
chromium-browser
+ which chromium-browser
chromium-browser
chromium-browser
chromium-browser
+ command=
+ readlink -f
+ return
+ binary=
+ [  ]
+ exit_failure_file_missing
+ [ 0 -gt 0 ]


In desktop_file_to_binary and binary_to_desktop_file functions, it makes false assumptions how many times grep may match. Those should treat each Exec match separately.
Comment 1 Chad MILLER 2015-09-28 22:30:30 UTC
Created attachment 118501 [details] [review]
desktopfile/binary mapping works for multi-Exec destop files

Patch against git tip to treat each matched line as a separate program.
Comment 2 GitLab Migration User 2019-02-16 13:36:53 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/xdg-utils/issues/83.


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.