Syntax error in /usr/bin/chromium-browser when xdg-settings get default-web-browser is empty

Bug #1853574 reported by Laurent Bonnaud
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
chromium-browser (Ubuntu)
Fix Released
Low
Olivier Tilloy
Eoan
Fix Released
Low
Olivier Tilloy

Bug Description

[Impact]

Minor. Apparently under certain circumstances "xdg-settings get default-web-browser" can return an empty string (although I haven't been able to reproduce this myself), and this will make the /usr/bin/chromium-browser wrapper script spit out a console error (but it won't prevent it from running the browser).
This is trivial to fix by enclosing the call to "xdg-settings get default-web-browser" in double quotes, to cater for the empty result case (see https://bazaar.launchpad.net/~chromium-team/chromium-browser/eoan-stable/revision/1526).

[Test Case]

1. Install chromium-browser
2. Patch /usr/bin/xdg-settings to make the get_browser_gnome3() function return an empty string (replace its body with 'echo ""')
3. From a terminal, run "chromium-browser"

Expected result: no error
Current result: /usr/bin/chromium-browser: 12: [: =: unexpected operator

[Regression Potential]

Low, enclosing a call to a command in double quotes in bash shouldn't have any undesirable side effect, and that's all that the patch does.

[Original Description]

Hi,

here is the error:

$ chromium-browser
/usr/bin/chromium-browser: 12: [: =: unexpected operator
[...]

Here is line 12 in /usr/bin/chromium-browser:

if [ $(xdg-settings get default-web-browser) = "chromium-browser.desktop" ]; then

The error occurs because on my system the default-web-browser setting is unset:

$ xdg-settings get default-web-browser
[nothing]

I suggest putting double quotes around:

if [ "$(xdg-settings get default-web-browser)" = "chromium-browser.desktop" ]; then

ProblemType: Bug
DistroRelease: Ubuntu 19.10
Package: chromium-browser 77.0.3865.120-0ubuntu1.19.10.1
Uname: Linux 5.3.12-050312-generic x86_64
ApportVersion: 2.20.11-0ubuntu8.3
Architecture: amd64
CurrentDesktop: KDE
DRM.card0-DP-1:
 enabled: disabled
 dpms: Off
 status: disconnected
 edid-base64:
 modes:
DRM.card0-HDMI-A-1:
 enabled: disabled
 dpms: Off
 status: disconnected
 edid-base64:
 modes:
DRM.card0-HDMI-A-2:
 enabled: disabled
 dpms: Off
 status: disconnected
 edid-base64:
 modes:
DRM.card0-eDP-1:
 enabled: enabled
 dpms: On
 status: connected
 edid-base64: AP///////wAJ5csGAAAAAAEaAQSVIhN4CvmglV1ZlCkkUFQAAAABAQEBAQEBAQEBAQEBAQEBGjuAJHE4PEAwIDYAWMIQAAAa/S2ADnE4KEAwIDYAWMIQAAAaAAAA/gBSTUpDWYBOVjE1TjQyAAAAAAAAQSKWABAAAAoBCiAgAMg=
 modes: 1920x1080 1920x1080
Date: Fri Nov 22 10:27:14 2019
DiskUsage:
 Filesystem Type Size Used Avail Use% Mounted on
 /dev/mapper/MonVolume2-UbuntuRacine ext4 492G 235G 232G 51% /
 tmpfs tmpfs 7.8G 124M 7.7G 2% /dev/shm
 /dev/mapper/MonVolume2-UbuntuRacine ext4 492G 235G 232G 51% /
Lsusb:
 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 001 Device 003: ID 0bda:58f6 Realtek Semiconductor Corp. Integrated_Webcam_HD
 Bus 001 Device 002: ID 046d:c03e Logitech, Inc. Premium Optical Wheel Mouse (M-BT58)
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
MachineType: Dell Inc. Latitude 5590
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.3.12-050312-generic root=/dev/mapper/MonVolume2-UbuntuRacine ro vsyscall=none security=apparmor intel_iommu=on quiet splash vt.handoff=7
Snap.ChromeDriverVersion: ChromeDriver 78.0.3904.108 (4b26898a39ee037623a72fcfb77279fce0e7d648-refs/branch-heads/3904@{#889})
Snap.ChromiumVersion:
 /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
 Chromium 78.0.3904.108 snap
SourcePackage: chromium-browser
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 07/19/2019
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 1.10.1
dmi.board.name: 0VYDFF
dmi.board.vendor: Dell Inc.
dmi.board.version: A00
dmi.chassis.type: 10
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvr1.10.1:bd07/19/2019:svnDellInc.:pnLatitude5590:pvr:rvnDellInc.:rn0VYDFF:rvrA00:cvnDellInc.:ct10:cvr:
dmi.product.family: Latitude
dmi.product.name: Latitude 5590
dmi.product.sku: 0817
dmi.sys.vendor: Dell Inc.

Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :
Revision history for this message
Olivier Tilloy (osomon) wrote :

I can reliably reproduce by modifying /usr/bin/xdg-settings to forcefully return an empty string for default-web-browser.

summary: - Syntax eror in /usr/bin/chromium-browser when xdg-settings get default-
+ Syntax error in /usr/bin/chromium-browser when xdg-settings get default-
web-browser is empty
Changed in chromium-browser (Ubuntu):
assignee: nobody → Olivier Tilloy (osomon)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Olivier Tilloy (osomon) wrote :
Changed in chromium-browser (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package chromium-browser - 78.0.3904.108-0ubuntu1

---------------
chromium-browser (78.0.3904.108-0ubuntu1) focal; urgency=medium

  * New upstream release: 78.0.3904.108
  * chromium-browser: fix syntax error when xdg-settings returns an empty
    string for default-web-browser (LP: #1853574)

 -- Olivier Tilloy <email address hidden> Fri, 22 Nov 2019 16:30:05 +0100

Changed in chromium-browser (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

Thank you for the quick fix!

Olivier Tilloy (osomon)
Changed in chromium-browser (Ubuntu Eoan):
status: New → In Progress
assignee: nobody → Olivier Tilloy (osomon)
importance: Undecided → Low
Revision history for this message
Olivier Tilloy (osomon) wrote :

As of today I haven't found a way to reproduce the problem without patching /usr/bin/xdg-settings. Even uninstalling all browsers, deleting the mimeinfo caches, rebooting the (virtual) machine, pretending to be other desktop environments, xdg-settings always reports that the default web browser is firefox.desktop. So importance is really very low, and I don't think this fix should be SRUed.

Changed in chromium-browser (Ubuntu Eoan):
status: In Progress → Won't Fix
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

@Olivier, does this mean we should reject chromium-browser from the queue?

Revision history for this message
Olivier Tilloy (osomon) wrote :

@Łukasz, sorry, I meant to update this bug to make it SRU-ready, but I somehow forgot to. SRU-wise the real important bug that the upload in the eoan queue fixes is bug #1858500, but as the fix for this one was already committed to the bzr branch, is minor and can't hurt, I don't see a reason to exclude it. I'll SRUify that bug right away.

Changed in chromium-browser (Ubuntu Eoan):
status: Won't Fix → In Progress
Olivier Tilloy (osomon)
description: updated
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Laurent, or anyone else affected,

Accepted chromium-browser into eoan-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/chromium-browser/79.0.3945.79-0ubuntu0.19.10.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-eoan to verification-done-eoan. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-eoan. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in chromium-browser (Ubuntu Eoan):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-eoan
Revision history for this message
Olivier Tilloy (osomon) wrote :

Verified. I followed the steps in the test case by installing chromium-browser in a clean eoan VM and verified that after patching get_browser_gnome3() in /usr/bin/xdg-settings I got the error message in the console. I then enabled eoan-proposed, installed the chromium-browser update (79.0.3945.79-0ubuntu0.19.10.2), and after that the error is gone when running chromium-browser.

tags: added: verification-done-eoan
removed: verification-needed-eoan
Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

The problem is also fixed on my system.
Thanks everybody for the fix!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package chromium-browser - 79.0.3945.79-0ubuntu0.19.10.2

---------------
chromium-browser (79.0.3945.79-0ubuntu0.19.10.2) eoan; urgency=medium

  * New release to fix the upgrade path from 19.04 to 19.10 (LP: #1858500)

chromium-browser (79.0.3945.79-0ubuntu0.19.10.1) eoan; urgency=medium

  * New upstream release: 79.0.3945.79
  * debian/apport/chromium-browser.py: add the output of
    "snap changes --abs-time chromium" to bugs reported by apport
  * chromium-browser: fix syntax error when xdg-settings returns an empty
    string for default-web-browser (LP: #1853574)

 -- Olivier Tilloy <email address hidden> Tue, 07 Jan 2020 15:47:31 +0100

Changed in chromium-browser (Ubuntu Eoan):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for chromium-browser has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.