Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bashism in 1.5.22 src/tests/ibus-desktop-testing-runner #2189

Closed
changwoo opened this issue Feb 26, 2020 · 3 comments
Closed

bashism in 1.5.22 src/tests/ibus-desktop-testing-runner #2189

changwoo opened this issue Feb 26, 2020 · 3 comments

Comments

@changwoo
Copy link

ibus-desktop-testing-runner in 1.5.22 failed in Debian, in which /bin/sh is not Bash but Dash.

/usr/lib/ibus/installed-tests/ibus-desktop-testing-runner: 173: export: -u`/bus: bad variable name

The problem seems to be $UID setting line which has been changed since 1.5.21. Here is a simple test:

changwoo@dev:~/tmp$ cat idtest.sh
#!/bin/sh

: ${UID:='`id -u`'}

echo "UID: $UID"
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus
echo $DBUS_SESSION_BUS_ADDRESS
changwoo@dev:~/tmp$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4  7월 19  2019 /bin/sh -> dash
changwoo@dev:~/tmp$ /bin/sh idtest.sh
UID: `id -u`
idtest.sh: 6: export: -u`/bus: bad variable name
changwoo@dev:~/tmp$ /bin/bash idtest.sh
UID: 1000
unix:path=/run/user/1000/bus
changwoo@dev:~/tmp$ 

Removing single quotes seems to work, at least for dash.

diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in
index 0d9a847c..caaf99e5 100755
--- a/src/tests/ibus-desktop-testing-runner.in
+++ b/src/tests/ibus-desktop-testing-runner.in
@@ -31,7 +31,7 @@
 # POSIX sh has no 'echo -e'
 : ${ECHO:='/usr/bin/echo'}
 # POSIX sh has $UID
-: ${UID:='`id -u`'}
+: ${UID:=`id -u`}
 
 
 PROGNAME=`basename $0`
@fujiwarat
Copy link
Member

I created a patch above and does it work for you?

@changwoo
Copy link
Author

I created a patch above and does it work for you?

Yes it does with /bin/dash

fujiwarat added a commit that referenced this issue Mar 3, 2020
Delete the single quotations to enclose grave chracters because
DASH saves the single quoted '`id -u`' as the raw string in the command
substitution not to be extracted.

BUG=#2189
@fujiwarat fujiwarat self-assigned this Mar 3, 2020
@fujiwarat fujiwarat added this to the 1.5.23 milestone Mar 3, 2020
@fujiwarat
Copy link
Member

Thank you for the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants