[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
This bug was fixed in the package xdg-utils - 1.1.3-4.1ubuntu1.22.04.1 --- xdg-utils (1.1.3-4.1ubuntu1.22.04.1) jammy; urgency=medium * Cherry-pick an upstream merge request to remove bashisms from xdg-settings (LP: #1970594) - debian/source/options - debian/patches/upstream-mr-remove-bashisms.patch -- Olivier Tilloy Tue, 03 May 2022 11:16:46 +0200 ** Changed in: xdg-utils (Ubuntu Jammy) Status: Fix Committed => 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/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
** Changed in: xdg-utils Status: Unknown => New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
I've updated the PR with a fix for this ugly message -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
Reported the "unexpected operator" error here: https://gitlab.freedesktop.org/xdg/xdg- utils/-/merge_requests/52#note_1389020. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
Successfully tested by doing the following: In a fully up-to-date jammy VM: $ sudo apt -y install libkf5config-bin $ export XDG_CURRENT_DESKTOP=KDE $ export KDE_SESSION_VERSION=5 $ xdg-settings get default-web-browser firefox.desktop $ xdg-settings check default-web-browser firefox.desktop /usr/bin/xdg-settings: 734: Bad substitution Then enabled the jammy-proposed pocket and updated xdg-utils to version 1.1.3-4.1ubuntu1.22.04.1: $ xdg-settings get default-web-browser firefox.desktop $ xdg-settings check default-web-browser foobar.desktop no $ xdg-settings check default-web-browser firefox.desktop /usr/bin/xdg-settings: 734: [: x!: unexpected operator yes The result is as expected in all cases. Note the extra "/usr/bin/xdg- settings: 734: [: x!: unexpected operator" on stderr in the last test. This is not expected, but it is harmless as the output on stdout is as expected. I will report a follow-up upstream bug to get that addressed. ** Tags removed: verification-needed-jammy ** Tags added: verification-done-jammy -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
Hello Olivier, or anyone else affected, Accepted xdg-utils into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/xdg- utils/1.1.3-4.1ubuntu1.22.04.1 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, what testing has been performed on the package and change the tag from verification-needed- jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification- failed-jammy. 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: xdg-utils (Ubuntu Jammy) Status: In Progress => Fix Committed ** Tags added: verification-needed verification-needed-jammy -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
** Description changed: + [Impact] + + The firefox snap (default in 22.04) will always report that it thinks + it's not the default browser (even when it actually is) for KDE users + (this can be seen when browsing to about:preferences). + + This is caused by an upstream bug in xdg-utils (using bashisms in KDE- + specific functions whereas the default interpreter is dash). + + The fix is rather trivial and will visibly improve the UX for those + users. + + + [Test Plan] + + In Kubuntu 22.04: + - make sure firefox isn't your default browser (by changing the setting to a different browser) + - run the firefox snap, browse to "about:preferences", and observe that firefox claims NOT to be the default browser + - click the "Set default" button + - refresh the page (F5) + - observe that now firefox claims to be the default browser + - in a terminal, execute `xdg-open https://example.org`, and verify that the page is open in the firefox snap + + [Where problems could occur] + + The patch is changing KDE-specific functions (check_browser_kde and + check_url_scheme_handler_kde), so in theory it shouldn't affect running + xdg-utils in any other desktop environment. + + If the proposed patch is incorrect, it would affect the functionality of + `xdg-settings check default-web-browser` and `xdg-settings check + default-url-scheme-handler`, so this is what needs to be thoroughly + tested in KDE. + + In the event of a regression, these functions wouldn't work as expected + (they already don't, so the user wouldn't observe a functional + regression, merely the absence of a fix). + + + [Original description] + I'm reporting this issue from stock Ubuntu, but the problem is observed only in Kubuntu (can be reliably reproduced in a Kubuntu 22.04 VM). The version of xdg-utils is identical. This problem was initially reported on the snapcraft forum: https://forum.snapcraft.io/t/firefox-wont-set-as-my-default- browser/29708. - $ xdg-settings check default-web-browser firefox_firefox.desktop - /usr/bin/xdg-settings: 734: Bad substitution + $ xdg-settings check default-web-browser firefox_firefox.desktop + /usr/bin/xdg-settings: 734: Bad substitution The offending line is: - if [ x"!" == x"${browser:0:1}" ]; then + if [ x"!" == x"${browser:0:1}" ]; then If I modify /usr/bin/xdg-settings in place to set the interpreter to /bin/bash on the first line of the script, the problem goes away. ProblemType: Bug DistroRelease: Ubuntu 22.04 Package: xdg-utils 1.1.3-4.1ubuntu1 ProcVersionSignature: Ubuntu 5.15.0-27.28-generic 5.15.30 Uname: Linux 5.15.0-27-generic x86_64 NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair ApportVersion: 2.20.11-0ubuntu82 Architecture: amd64 CasperMD5CheckResult: unknown CurrentDesktop: ubuntu:GNOME Date: Wed Apr 27 11:21:31 2022 InstallationDate: Installed on 2020-09-16 (587 days ago) InstallationMedia: Ubuntu 20.10 "Groovy Gorilla" - Alpha amd64 (20200910) PackageArchitecture: all SourcePackage: xdg-utils UpgradeStatus: Upgraded to jammy on 2022-03-19 (38 days ago) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
** Changed in: xdg-utils (Ubuntu Jammy) Status: Confirmed => In Progress -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
** Also affects: xdg-utils (Ubuntu Jammy) Importance: Undecided Status: New ** Changed in: xdg-utils (Ubuntu Jammy) Status: New => Confirmed ** Changed in: xdg-utils (Ubuntu Jammy) Assignee: (unassigned) => Olivier Tilloy (osomon) ** Changed in: xdg-utils (Ubuntu Jammy) Importance: Undecided => Medium -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
This bug was fixed in the package xdg-utils - 1.1.3-4.1ubuntu2 --- xdg-utils (1.1.3-4.1ubuntu2) kinetic; urgency=medium * Cherry-pick an upstream merge request to remove bashisms from xdg-settings (LP: #1970594) - debian/source/options - debian/patches/upstream-mr-remove-bashisms.patch -- Olivier Tilloy Tue, 03 May 2022 11:16:46 +0200 ** Changed in: xdg-utils (Ubuntu) Status: In Progress => 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/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
** Changed in: xdg-utils (Ubuntu) Assignee: (unassigned) => Olivier Tilloy (osomon) ** Changed in: xdg-utils (Ubuntu) Status: Confirmed => In Progress ** Changed in: xdg-utils (Ubuntu) Importance: Undecided => Medium -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
** Also affects: xdg-utils via https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/10 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
It turns out it's a known issue: https://gitlab.freedesktop.org/xdg/xdg- utils/-/issues/10. ** No longer affects: kubuntu-meta (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
Those are good points. I'm a bit baffled that this was not noticed by other users of xdg-settings earlier. Maybe KDE users don't usually rely on it? I'll file an upstream bug. ** Bug watch added: gitlab.freedesktop.org/xdg/xdg-utils/-/issues #10 https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/10 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
Why in stock Ubuntu and not Kubuntu, I think is because the offending code is inside functions that are named as though only KDE is supposed to use them. For example, the default browser break is inside a function named `check_browser_kde()`. There might be some logic to determine that your stock Ubuntu, even if it is currently running a KDE session, supports testing via the gnome code paths: i.e. via `check_browser_gnome()` With regards to bash specifics inside a project declaring /bin/sh as the interpreter I would guess it is a bug that has crept through without being caught. The upstream project likely wants to remain portable and not rely on BASH so they probably should drop the BASH-isms. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/kubuntu-meta/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
I suppose that would work (although I haven't actually tested to confirm, but it looks correct and I'm trusting your shell-fu). The real questions are: * why is this working in stock Ubuntu (where /bin/sh is also a symlink to dash) and not in Kubuntu? * why does the upstream project declare /bin/sh as the default interpreter for xdg-settings, yet use bash-specific string manipulation functions? -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/kubuntu-meta/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
There is also a similar statement that needs fixing for DASH on line 1090: if [ x"!" == x"${binary:0:1}" ]; then ** 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/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/kubuntu-meta/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1970594] Re: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution
Can you try replacing the line with: if [ x"!" == x"$(printf %.1s "$browser")" ]; then and reverting back to dash? I think this might work in most posix shells, without requiring to move to bash. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1970594 Title: "xdg-settings check default-web-browser something.desktop" fails in Kubuntu 22.04: Bad substitution To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/kubuntu-meta/+bug/1970594/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs