← Back to team overview

desktop-packages team mailing list archive

[Bug 1511154] [NEW] xdg-settings set <anything> fails with status 2 because of a small glitch

 

Public bug reported:

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." has no response.

The problem is reported here http://askubuntu.com/questions/688779
/google-chrome-stable-keeps-asking-if-it-should-be-set-to-default but
the answer is somewhat wrong.

I have successfully reproduced and debugged the problem. I managed to
establish that it is connected to xdg-utils, namely to /usr/bin/xdg-
settings script.

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-chrome.desktop
michal@furia:~$ echo $?
2
michal@furia:~$ xdg-settings get default-web-browser
firefox.desktop

There is a function in /usr/bin/xdg-settings called
desktop_file_to_binary() and it has a bug. It is slightly different than
the one in the vanilla xdg-utils 1.1.0 rc3. It is implemented in scripts
/xdg-utils-common.in.

See line 65 in xdg-utils-1.1.0~rc3+git20150907/scripts/xdg-utils-
common.in :

command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e
's/ .*$//'`"

When executed against google-chrome.desktop or firefox.desktop it
results with:

google-chrome-stable
google-chrome-stable
google-chrome-stable

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

Then we would have only one `google-chrome-stable` or `firefox` which in
turn would result with the actual path to binary resolved correctly and
that would make xdg-settings work fine.

Also, it is possible to set Google Chrome as the default browser via its
preferences and the aforementioned first user-facing symptom is gone.

** Affects: xdg-utils (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  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." has no response.
+ 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." has no response.
  
  The problem is reported here http://askubuntu.com/questions/688779
  /google-chrome-stable-keeps-asking-if-it-should-be-set-to-default but
  the answer is somewhat wrong.
  
  I have successfully reproduced and debugged the problem. I managed to
  establish that it is connected to xdg-utils, namely to /usr/bin/xdg-
  settings script.
  
- ```
  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-chrome.desktop
  michal@furia:~$ echo $?
  2
  michal@furia:~$ xdg-settings get default-web-browser
  firefox.desktop
- ```
  
  There is a function in /usr/bin/xdg-settings called
  desktop_file_to_binary() and it has a bug. It is slightly different than
  the one in the vanilla xdg-utils 1.1.0 rc3. It is implemented in scripts
  /xdg-utils-common.in.
  
  See line 65 in xdg-utils-1.1.0~rc3+git20150907/scripts/xdg-utils-
  common.in :
  
- ```
- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e 's/ .*$//'`"
- ```
+ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e
+ 's/ .*$//'`"
  
  When executed against google-chrome.desktop or firefox.desktop it
  results with:
  
- ```
  google-chrome-stable
  google-chrome-stable
  google-chrome-stable
- ```
  
  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 -1`.
  
  Then we would have only one `google-chrome-stable` or `firefox` which in
  turn would result with the actual path to binary resolved correctly and
  that would make xdg-settings work fine.
+ 
+ Also, it is possible to set Google Chrome as the default browser via its
+ preferences and the aforementioned first user-facing symptom is gone.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to xdg-utils in Ubuntu.
https://bugs.launchpad.net/bugs/1511154

Title:
  xdg-settings set <anything> fails with status 2 because of a small
  glitch

Status in xdg-utils package in Ubuntu:
  New

Bug description:
  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." has no response.

  The problem is reported here http://askubuntu.com/questions/688779
  /google-chrome-stable-keeps-asking-if-it-should-be-set-to-default but
  the answer is somewhat wrong.

  I have successfully reproduced and debugged the problem. I managed to
  establish that it is connected to xdg-utils, namely to /usr/bin/xdg-
  settings script.

  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-chrome.desktop
  michal@furia:~$ echo $?
  2
  michal@furia:~$ xdg-settings get default-web-browser
  firefox.desktop

  There is a function in /usr/bin/xdg-settings called
  desktop_file_to_binary() and it has a bug. It is slightly different
  than the one in the vanilla xdg-utils 1.1.0 rc3. It is implemented in
  scripts/xdg-utils-common.in.

  See line 65 in xdg-utils-1.1.0~rc3+git20150907/scripts/xdg-utils-
  common.in :

  command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed
  -e 's/ .*$//'`"

  When executed against google-chrome.desktop or firefox.desktop it
  results with:

  google-chrome-stable
  google-chrome-stable
  google-chrome-stable

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

  Then we would have only one `google-chrome-stable` or `firefox` which
  in turn would result with the actual path to binary resolved correctly
  and that would make xdg-settings work fine.

  Also, it is possible to set Google Chrome as the default browser via
  its preferences and the aforementioned first user-facing symptom is
  gone.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions


Follow ups