Package: debianutils Version: 2.25.1 Severity: minor
Two bits of extraneous code to remove: lines 30-33: 30 case $PATH in 31 *::) : "not *DIR:" ;; 32 *:) PATH="$PATH:" ;; 33 esac Unless this is for some weird nonstandard bourne implementation, the argument "not *DIR:" to the colon (:) builtin on line 31 is ignored, and the whole purpose of the entire case statement, that of ensuring a trailing colon, is unnecessary, as the tokenizer works fine when the last token has no delimiter (e.g. "for i in 1 2 3; do echo $i; done" writes three lines, as does "IFS=:; for i in 1:2:3; do echo $i; done" ... you do not need "1:2:3:" to properly parse the last token "3"). lines 47-49: 47 if [ -z "$ELEMENT" ]; then 48 ELEMENT=. 49 fi I've never heard of somebody's path including an empty string; this only triggers on a path like PATH="/usr/local/bin:'':/usr/bin." I think this is another misunderstanding of Bourne shell tokenization. The only other application I can see for this would be if Bourne interpreted a PATH="/usr/local/bin::/usr/bin" as having the tokens '/usr/local/bin' and '' and '/usr/bin' (which it does not), in which case there would be an empty token, but why should that be interpreted as the current directory? In the event there IS an empty string in handed to the loop on line 46, nothing will happen unless the argument ("$PROGRAM") happens to exist as a file in / with executable permissions (assuming you remove lines 47-49, otherwise it searches the current directory). If you really want to be able to handle a corner case like that, add a third test to line 57 (line 43 on my patched version) to test for '[ -n "$ELEMENT" ]' (sans single-quotes). This goes third so that it is never used except in these rare corner cases (due to short circuiting). --- which.dpkg 2007-09-30 09:31:40.000000000 -0400 +++ which 2007-11-28 17:23:45.647330496 -0500 @@ -27,10 +27,6 @@ else ALLRET=0 fi -case $PATH in - *::) : "not *DIR:" ;; - *:) PATH="$PATH:" ;; -esac for PROGRAM in "$@"; do RET=1 IFS_SAVE="$IFS" @@ -44,9 +40,6 @@ ;; *) for ELEMENT in $PATH; do - if [ -z "$ELEMENT" ]; then - ELEMENT=. - fi if [ -f "$ELEMENT/$PROGRAM" ] && [ -x "$ELEMENT/$PROGRAM" ]; then puts "$ELEMENT/$PROGRAM" RET=0 -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (995, 'testing'), (500, 'testing'), (500, 'stable'), (50, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.18-4-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages debianutils depends on: ii libc6 2.6.1-1+b1 GNU C Library: Shared libraries debianutils recommends no packages. -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]