xdg-settings (used to) assume desktop files have exactly one Exec line
Bug #1517956 reported by
Chad Miller
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Xdg-utils |
Unknown
|
Medium
|
|||
xdg-utils (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
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\
Changed in xdg-utils: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
Changed in xdg-utils: | |
status: | Confirmed → Unknown |
To post a comment you must log in.
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 chromium- browser file_missing
+ command=
chromium-browser
chromium-browser
chromium-browser
+ which chromium-browser
chromium-browser
chromium-browser
chromium-browser
+ command=
+ readlink -f
+ return
+ binary=
+ [ ]
+ exit_failure_
+ [ 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.