keychain not compatible with dash despite using /bin/sh

Bug #1705338 reported by John Hubbard
This bug report is a duplicate of:  Bug #1508699: 'keychain --list' prints error. Edit Remove
6
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.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

$ file /usr/bin/keychain
/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="${HOSTNAME}"

summary: - keychain not compatible with dash dispite using /bin/sh
+ keychain not compatible with dash despite using /bin/sh
Changed in keychain (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
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.