[patch] bug #7 -- which(1) is b0rked

Paul Fox pgf at brightstareng.com
Wed Aug 31 13:06:59 UTC 2005


 > Hi,
 > 
 > http://bugs.busybox.net/view.php?id=7
 > 
 > sizes are inlined in the patch.
 > 
 > 
 > PS: please see the bug-comment wrt '::' and let me know if i should deal
 > with it or not.

i've added a note to the bug, which bernhard has probably seen by
now, but for the list:  the issue is that "which" doesn't treat
empty directories in $PATH as the current directory, and
therefore won't always find executables that the shell would
find.  PATH has always been interpreted this way by /bin/sh, as
well as by bash.  (though the man page doesn't say so -- that's a
serious omission, in my opinion).

examples:
    :/bin:/usr/bin
is equivalent to:
    .:/bin:/usr/bin

and:
    $HOME/bin::/bin:/usr/bin
is equivalent to:
    $HOME/bin:.:/bin:/usr/bin

(and of course a trailing ':' puts current directory last.)


paul
=---------------------
 paul fox, pgf at brightstareng.com



More information about the busybox mailing list