Package: keychain
Version: 2.6.8-2
Severity: normal
Tags: patch
I run "eval `keychain --eval --quiet --inherit any --quick`" from my
shell startup scripts. When stdout is not a tty (for example, when I ssh
into this machine with a single command, rather than in such a way as to
get an interactive shell), the following is printed on stderr:
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
keychain does have the following code:
# Don't use color if there's no terminal on stdout
if [ -n "$OFF" ]; then
tty <&1 >/dev/null 2>&1 || unset BLUE CYAN GREEN OFF RED
fi
However, right at the top of the script, well before this check, it
runs:
type tput >/dev/null 2>/dev/null
{
BLUE="$(tput setaf 4)"
CYAN="$(tput setaf 6)"
GREEN="$(tput setaf 2)"
RED="$(tput setaf 1)"
OFF="$(tput sgr0)"
}
It's this block that produces the errors.
To start with, this is clearly not what the author meant; { list; } just
means to execute the list in the current shell environment, which is a
no-op in this context, and the 'type' command does nothing. The author
appears to have been thinking in some different language and managed to
render it into valid but incorrect shell. As far as I can divine the
intent, this should have read:
if type tput >/dev/null 2>/dev/null; then
BLUE="$(tput setaf 4)"
CYAN="$(tput setaf 6)"
GREEN="$(tput setaf 2)"
RED="$(tput setaf 1)"
OFF="$(tput sgr0)"
fi
In order to fix this bug, it should further be changed as expressed in
the following patch:
--- keychain.orig 2009-01-24 12:22:29.000000000 +0000
+++ keychain 2009-01-24 12:24:03.000000000 +0000
@@ -42,14 +42,16 @@
confirmopt=false
unset ssh_confirm
-type tput >/dev/null 2>/dev/null
-{
+# Don't use color if there's no terminal on stdout
+if type tput >/dev/null 2>/dev/null && tty <&1 >/dev/null 2>&1; then
BLUE="$(tput setaf 4)"
CYAN="$(tput setaf 6)"
GREEN="$(tput setaf 2)"
RED="$(tput setaf 1)"
OFF="$(tput sgr0)"
-}
+else
+ unset BLUE CYAN GREEN RED OFF
+fi
# GNU awk and sed have regex issues in a multibyte environment. If any locale
# variables are set, then override by setting LC_ALL
@@ -1396,11 +1398,6 @@
. "$envf"
fi
-# Don't use color if there's no terminal on stdout
-if [ -n "$OFF" ]; then
- tty <&1 >/dev/null 2>&1 || unset BLUE CYAN GREEN OFF RED
-fi
-
# versinfo uses qprint, which honors --quiet
versinfo
[ "$myaction" = version ] && exit 0
Thanks,
--
Colin Watson [[email protected]]
-- System Information:
Debian Release: 5.0
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages keychain depends on:
ii grep 2.5.3~dfsg-6 GNU grep, egrep and fgrep
ii openssh-client [ssh-client] 1:5.1p1-5 secure shell client, an rlogin/rsh
keychain recommends no packages.
Versions of packages keychain suggests:
ii gnupg-agent 2.0.9-3.1 GNU privacy guard - password agent
pn ssh-askpass <none> (no description available)
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]