Package: debianutils
Version: 2.15.1
Severity: important
File: /bin/which
Tags: patch
Hi,
On my system /bin/sh points to ksh, which doesn't provide the printf
builtin unlike bash does. So the /bin/which command calls /usr/bin/printf,
which may not be available at the boot time if /usr hasn't been mounted yet.
For the real time example of the bug see /etc/rcS.d/S30procps.sh script,
which calls `which' and runs just before the /etc/rcS.d/S35mountall.sh
I would suggest using good, old echo istead of printf. The attached patch
implements this.
Best regards,
robert
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (100, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/pdksh
Kernel: Linux 2.6.14
Locale: LANG=pl_PL, LC_CTYPE=pl_PL (charmap=ISO-8859-2)
Versions of packages debianutils depends on:
ii coreutils 5.93-5 The GNU core utilities
ii libc6 2.3.5-8 GNU C Library: Shared libraries an
debianutils recommends no packages.
-- no debconf information
--- which.orig 2005-11-04 02:51:05.000000000 +0100
+++ which 2005-11-21 21:38:09.000000000 +0100
@@ -7,7 +7,7 @@
do
case "$whichopts" in
a) ALLMATCHES=1 ;;
- ?) printf "Usage: %s [-a] args\n" $0 ; exit 2 ;;
+ ?) echo "Usage: $0 [-a] args\n" 1>&2 ; exit 2 ;;
esac
done
shift $(($OPTIND - 1))
@@ -28,7 +28,7 @@
case $PROGRAM in
*/*)
if [ -f "$PROGRAM" ] && [ -x "$PROGRAM" ]; then
- printf '%s\n' "$PROGRAM"
+ echo "$PROGRAM"
RET=0
fi
;;
@@ -38,7 +38,7 @@
ELEMENT=.
fi
if [ -f "$ELEMENT/$PROGRAM" ] && [ -x "$ELEMENT/$PROGRAM" ]; then
- printf '%s\n' "$ELEMENT/$PROGRAM"
+ echo "$ELEMENT/$PROGRAM"
RET=0
[ "$ALLMATCHES" -eq 1 ] || break
fi