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

Bernhard Fischer rep.nop at aon.at
Fri Sep 9 20:42:20 UTC 2005


On Fri, Sep 02, 2005 at 09:10:00AM -0500, Rob Landley wrote:
>On Thursday 01 September 2005 22:43, Paul Fox wrote:
>>  > > are you suggesting that we change all of the busybox shell code
>>  > > to not handle this case?  like it or not, this behavior with
>>  > > respect to PATH has existed forever.  it's part of execvp(), for
>>  > > instance.
>>  >
>>  > I was under the impression we didn't handle it now...
>>
>> no -- only the "which" command is broken, which is what the bug
>> is about.  (see Subject :-)  the shells are fine.

I attached a patch to bug #7 for this earlier, just as a note.

Can someone please apply
http://bugs.busybox.net/file_download.php?file_id=349&type=bug

PS: we can add -a later and/or tweak that applet's size. Please let's
get fixed and applied the stringent deficiencies first.
TIA,
Bernhard

testcase? well kindof.. i used:
$ cat which.sh
run_me () {
echo "# $*"
$*
}

do_test () {
echo "PATH=$PATH"
  OUT0=$(which busybox bar mkdir server fvgetty)
  RET0=$?
  OUT1=$(./busybox which busybox bar mkdir server fvgetty)
  RET1=$?
[ $RET1 -eq $RET0 ] && echo "PASSED: return" || echo "XXX wrong return:
expected '$RET0' got '$RET1'"
if [ "$OUT1" = "$OUT0" ]
then
  echo "PASSED: output"
else
  echo "XXX wrong OUTPUT:"
  echo "expected:"
  echo "$OUT0"
  echo "got:"
  echo "$OUT1"
  echo "XXX ----"
fi
}
export PATH="/sbin:/bin:/usr/sbin:/usr/bin:/opt/fresco/bin"
do_test
export PATH=":$PATH"
do_test
export PATH=":$PATH"
do_test
export PATH="/sbin:/bin::/usr/sbin:/usr/bin:/opt/fresco/bin"
do_test




More information about the busybox mailing list