#950495 /usr/bin/xdg-settings: 735: Bad substitution

Package:
xdg-utils
Source:
xdg-utils
Submitter:
luca
Date:
2023-10-09 17:39:04 UTC
Severity:
normal
Tags:
#950495#5
Date:
2020-02-02 15:32:50 UTC
From:
To:
Dear Maintainer,

$ sh -x /usr/bin/xdg-settings check default-web-browser firefox.desktop
+ check_common_commands check default-web-browser firefox.desktop
+ [ 3 -gt 0 ]
+ parm=check
+ shift
+ [ 2 -gt 0 ]
+ parm=default-web-browser
+ shift
+ [ 1 -gt 0 ]
+ parm=firefox.desktop
+ shift
+ [ 0 -gt 0 ]
+ [ -z  ]
+ unset XDG_UTILS_DEBUG_LEVEL
+ [ 0 -lt 1 ]
+ xdg_redirect_output= > /dev/null 2> /dev/null
+ [ xcheck = x--list ]
+ [ xcheck != x ]
+ [ xdefault-web-browser != x ]
+ [ xcheck = xget -o xfirefox.desktop != x ]
+ op=check
+ parm=default-web-browser
+ shift 2
+ [ xcheck != xget -a xcheck != xcheck -a xcheck != xset ]
+ detectDE
+ unset GREP_OPTIONS
+ [ -n KDE ]
+ DE=kde
+ [ xkde = x ]
+ [ xkde = x ]
+ [ xkde = x ]
+ [ xkde = xgnome ]
+ [ -f /run/user/500/flatpak-info ]
+ [ -z kde ]
+ dispatch_specific kde firefox.desktop
+ local handler=kde
+ shift
+ [ xcheck = xget ]
+ [ xcheck = xcheck ]
+ check_desktop_filename firefox.desktop
+ return
+ check_browser_kde firefox.desktop
+ desktop_file_to_binary firefox.desktop
+ search=/home/ilprof/.local/share:/usr/share:/usr/share:/usr/local/share
+ basename firefox.desktop
+ desktop=firefox.desktop
+ IFS=:
+ unset IFS
+ [ /home/ilprof/.local/share ]
+ [ -d /home/ilprof/.local/share/applications ]
+ [ firefox.desktop != firefox.desktop ]
+ test -z
+ file=/home/ilprof/.local/share/applications//firefox.desktop
+ [ -r /home/ilprof/.local/share/applications//firefox.desktop ]
+ file=/home/ilprof/.local/share/applications/javaws//firefox.desktop
+ [ -r /home/ilprof/.local/share/applications/javaws//firefox.desktop ]
+ file=/home/ilprof/.local/share/applications/wine//firefox.desktop
+ [ -r /home/ilprof/.local/share/applications/wine//firefox.desktop ]
+ file=/home/ilprof/.local/share/applnk//firefox.desktop
+ [ -r /home/ilprof/.local/share/applnk//firefox.desktop ]
+ file=/home/ilprof/.local/share/applnk/*//firefox.desktop
+ [ -r /home/ilprof/.local/share/applnk/*//firefox.desktop ]
+ [ -r  ]
+ unset IFS
+ [ /usr/share ]
+ [ -d /usr/share/applications ]
+ [ firefox.desktop != firefox.desktop ]
+ test -z
+ file=/usr/share/applications//firefox.desktop
+ [ -r /usr/share/applications//firefox.desktop ]
+ file_path=/usr/share/applications//firefox.desktop
+ break
+ [ -r /usr/share/applications//firefox.desktop ]
+ grep -E ^Exec(\[[^]=]*])?= /usr/share/applications//firefox.desktop
+ cut -d= -f 2-
+ first_word
+ read first rest
+ echo /usr/lib/firefox/firefox
+ command=/usr/lib/firefox/firefox
+ which /usr/lib/firefox/firefox
+ command=/usr/lib/firefox/firefox
+ readlink -f /usr/lib/firefox/firefox
+ return
+ check=/usr/lib/firefox/firefox
+ [ -z /usr/lib/firefox/firefox ]
+ read_kde_browser
+ read_kde_config kdeglobals General BrowserApplication
+ configfile=kdeglobals
+ configsection=General
+ configkey=BrowserApplication
+ [ x5 = x5 ]
+ kreadconfig5 --file kdeglobals --group General --key BrowserApplication
+ application=!/usr/bin/firefox
+ [ x!/usr/bin/firefox != x ]
+ echo !/usr/bin/firefox
+ browser=!/usr/bin/firefox
+ resolve_kde_browser
+ [ -z !/usr/bin/firefox ]
+ echo /usr/bin/firefox
+ binary=/usr/bin/firefox
/usr/bin/xdg-settings: 735: Bad substitution
--------------------------------------------------------------------------------------

debian links /bin/dash to /bin/sh so the script seems fail, while it's working
with bash

$ bash /usr/bin/xdg-settings check default-web-browser firefox.desktop
yes

#950495#10
Date:
2020-02-19 17:09:34 UTC
From:
To:
Control: forwarded -1 https://gitlab.freedesktop.org/xdg/xdg-utils/issues/10

Looks like you're running into
https://gitlab.freedesktop.org/xdg/xdg-utils/issues/10

Cheers,
Emilio

#950495#17
Date:
2020-02-19 17:32:42 UTC
From:
To:
Il 19/02/20 18:09, Emilio Pozuelo Monfort ha scritto:

Hi Emilio,

no in my case |read_kde_browser()|doesn't returns an empty string, but
"/usr/bin/firefox" as you can see in the attached log.

the problem is that bash works with x"${browser:0:1}" and dash doesn't. Debian set /bin/sh as /bin/dash.

the shabang of**xdg-settings is #!/bin/sh

#950495#22
Date:
2020-02-19 18:16:32 UTC
From:
To:
Ok, I see. Can you open an issue in the upstream tracker at [1]?

[1] https://gitlab.freedesktop.org/xdg/xdg-utils/issues/new

Thanks,
Emilio

#950495#27
Date:
2020-02-19 18:51:45 UTC
From:
To:
Il 19/02/20 19:16, Emilio Pozuelo Monfort ha scritto:

Done.

https://gitlab.freedesktop.org/xdg/xdg-utils/issues/165