[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
I am still seeing the "Google Chrome is not your default browser" on bionic. 4.15.0-32-generic #35-Ubuntu SMP Fri Aug 10 17:58:07 UTC 2018 x86_64 GNU/Linux DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS" NAME="Ubuntu" VERSION="18.04.1 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.1 LTS" VERSION_ID="18.04" HOME_URL="https://www.ubuntu.com/"; SUPPORT_URL="https://help.ubuntu.com/"; BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"; PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"; VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic Chrome version: Google Chrome Version 68.0.3440.106 (Official Build) unknown (64-bit) I'm running this in a VirtualBox VM on Win 10. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
Had the same problem and can confirm editing /usr/bin/xdg-settings fixes the problem! -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
I can also confirm this problem in 15.10. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
** Description changed: + (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://askubuntu.com/questions/688779 /google-chrome-stable-keeps-asking-if-it-should-be-set-to-default but the answer is somewhat wrong. + + [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/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 -n 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. + + [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. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
I can confirm this problem in 15.10, and editing /usr/bin/xdg-settings as mentioned fixes the problem, allowing the default browser to be properly set. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
Need backport to 15.10 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
Hope backport to wily -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
This bug i still present in 15.10 and it's very annoying. Will it be fixed there? -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
Hi, can this be backported to wily too? -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
This bug was fixed in the package xdg-utils - 1.1.0~rc3+git20150907-1ubuntu3 --- xdg-utils (1.1.0~rc3+git20150907-1ubuntu3) xenial; urgency=medium [ Iuri Chaer ] * debian/patches/handle-multiple-exec-lines.patch: - Handle desktop files (like Chrome's) that have more than one Exec line in them. LP: #1511154 -- Michael Terry Thu, 19 Nov 2015 16:56:07 -0500 ** Changed in: xdg-utils (Ubuntu) Status: Confirmed => Fix Released -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
Thanks for the patch! I've uploaded it to xenial. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
** Changed in: xdg-utils (Ubuntu) Importance: Undecided => Medium ** Tags added: wily -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
Actually, you may want to do the same for the other lines grepping for Exec inside .desktop files as well :) ** Patch added: "Patching all lines grepping for Exec inside .desktop files with head -n1." https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+attachment/4516305/+files/xdg-settings.1.patch -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
The attachment "Add head -n1 to grep for Exec inside .desktop file, so the next command doesn't get a multiline input." seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team. [This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.] ** Tags added: patch -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
Attaching a patch with Michał's proposed fix, which works for me. I think it makes sense to use head -n1, the first Exec entry is likely to be a good pick -- if anyone adds a funny Exec entry, I'd expect it to not be the first one. I've found the same bug through a different path -- I ran execsnoop to try and figure out what chromium was doing when it complained about not being the default browser, and it's actually invoking `xdg-settings check default-web-browser chromium-browser.desktop`, which, in my environment (identified as gnome3) calls the exact same desktop_file_to_binary ... function. ** Patch added: "Add head -n1 to grep for Exec inside .desktop file, so the next command doesn't get a multiline input." https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+attachment/4516300/+files/xdg-settings.patch -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
Status changed to 'Confirmed' because the bug affects multiple users. ** Changed in: xdg-utils (Ubuntu) Status: New => Confirmed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
** 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. + "Make Google Chrome the default browser." on Chrome's settings page 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 -n 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 Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1511154] Re: xdg-settings set fails with status 2 because of a small glitch
** 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. 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`. + be adding `| head -n 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 Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511154 Title: xdg-settings set fails with status 2 because of a small glitch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1511154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs