xdg-settings set <anything> fails with status 2 because of a small glitch
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
xdg-utils (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
(Existing description has been broken up into sections.)
[Impact]
The first user-facing symptom: Google Chrome stable is correctly set as the default browser in System Settings / Details / Default Applications as well as in
update-alternatives --display x-www-browser
yet it keeps complaining about not being a default browser. Clicking "Make Google Chrome the default browser." on Chrome's settings page has no response.
The problem is reported here http://
[Test Case]
I have successfully reproduced and debugged the problem. I managed to establish that it is connected to xdg-utils, namely to /usr/bin/
michal@furia:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily
michal@furia:~$ xdg-settings get default-web-browser
firefox.desktop
michal@furia:~$ xdg-settings set default-web-browser google-
michal@furia:~$ echo $?
2
michal@furia:~$ xdg-settings get default-web-browser
firefox.desktop
There is a function in /usr/bin/
See line 65 in xdg-utils-
command="`grep -E "^Exec(
When executed against google-
google-
google-
google-
or
firefox
firefox
firefox
respectively.
When passed to `which` and then to `readlink -f` it results with no path to the actual binary. In the vanilla xdg-utils package (version 1.1.0 rc3) the `sed` part is replaced with `first_word`. An alternative would be adding `| head -n 1`.
Then we would have only one `google-
Also, it is possible to set Google Chrome as the default browser via its preferences and the aforementioned first user-facing symptom is gone.
[Regression Potential]
Limited. The commands after the modified lines assume that there is only one line, so passing the output of the modified lines through `head -n1` should ensure that. In the case of there being 0 or 1 lines before the `head -n1` command, nothing will be changed.
In the worst case, there may exist a .desktop file where the first Exec line isn't the main program (mentioned in comment 2 below). In that case, however, this change will result in the incorrect program being chosen; this may or may not be better than the command not working at all.
Related branches
description: | updated |
description: | updated |
description: | updated |
Changed in xdg-utils (Ubuntu): | |
importance: | Undecided → Medium |
tags: | added: wily |
description: | updated |
Status changed to 'Confirmed' because the bug affects multiple users.