keychain not compatible with dash despite using /bin/sh
Bug #1705338 reported by
John Hubbard
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
keychain (Ubuntu) |
Triaged
|
Medium
|
Unassigned |
Bug Description
Calling "keychain -l" to list the loaded keys produces the message:
/usr/bin/keychain: 1537: [: end: unexpected operator
end
I suspect that keychain uses bashisms despite the fact that #!/bin/sh is called out (which resolves to dash). Things behave normally after hacking /usr/bin/keychain to so that is relies on /bin/bash instead of /bin/sh --> dash.
I believe that the fix is either to change the shell from sh/dash to bash or to remove the bashisms. It might be appropriate to fix things upstream.
To post a comment you must log in.
$ file /usr/bin/keychain "${HOSTNAME} "
/usr/bin/keychain: POSIX shell script, ASCII text executable, with escape sequences
leggewie@work:~$ checkbashisms /usr/bin/keychain
possible bashism in /usr/bin/keychain line 384 (sleep only takes one integer):
sleep 0.5; counter=$(( $counter + 1 ))
possible bashism in /usr/bin/keychain line 408 ($(OS|MACH)TYPE):
[ -n "$OSTYPE" ] || getos
possible bashism in /usr/bin/keychain line 411 ($(OS|MACH)TYPE):
case "$OSTYPE" in
possible bashism in /usr/bin/keychain line 1120 ('command' with option other than -p):
if command -v ${a}-agent >/dev/null; then
possible bashism in /usr/bin/keychain line 1129 ('command' with option other than -p):
command -v ${a}-agent >/dev/null || continue
possible bashism in /usr/bin/keychain line 1351 ($HOST(TYPE|NAME)):
[ -z "$hostopt" ] && hostopt=