[BusyBox-cvs] [BusyBox 0000007]: which and wd-located files
bugs at busybox.net
bugs at busybox.net
Mon Jul 18 22:12:46 UTC 2005
A NOTE has been added to this issue.
======================================================================
http://busybox.net/bugs/view.php?id=7
======================================================================
Reported By: felipek
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 7
Category: Standards Compliance
Reproducibility: always
Severity: minor
Priority: normal
Status: assigned
======================================================================
Date Submitted: 01-13-2005 06:06 PST
Last Modified: 07-18-2005 15:12 PDT
======================================================================
Summary: which and wd-located files
Description:
which doesn't search $PATH when there's a file in the WD with the same name
of the 'filename' parameter -- the "original which" behaves different. The
problem was reported by Brian T (24aa01c4d719$fa6d7c50$fd0ba8c0 at briantpc)
and fixed by me (Pine.LNX.4.61.0412010307520.25751 at nyvra.alien.bet).
Additional information includes my reply.
======================================================================
----------------------------------------------------------------------
vsauder - 06-21-05 11:52
----------------------------------------------------------------------
I also note that 'which' does not discern between executables and
directories. The access() method used is just a file/dir permission
checker. There are no provisions to determine that the path being checked
is a file.
Example:
# touch ls
# ls -l
-rw-r--r-- 1 root root 0 Jun 21 14:41 ls
# which ls
/bin/ls
# chmod a+x ls
# which ls
ls
# echo $PATH
/usr/sbin:/bin:/usr/bin:/sbin:.
# rm ls
# mkdir ls
# which ls
ls
# ls -l
drwxr-xr-x 2 root root 40 Jun 21 14:44 ls
>From the which man page:
Which takes one or more arguments. For each of its arguments it prints
to stdout the full path of the executables that would have been exe-
cuted when this argument had been entered at the shell prompt.
It seems to me that even a minimalistic implementation should not show
directories.
----------------------------------------------------------------------
pgf - 07-18-05 15:12
----------------------------------------------------------------------
I agree. the behavior with respect to dirs should be fixed before this is
committed. also, the original patch doesn't work correctly if PATH
contains
the current dir, via "::", i.e. "PATH=/bin:/usr/bin::/usr/local/bin".
Issue History
Date Modified Username Field Change
======================================================================
01-13-05 06:06 felipek New Issue
01-13-05 06:06 felipek File Added: bb-which.patch
01-13-05 06:07 felipek Issue Monitored: felipek
03-16-05 12:26 andersen Assigned To andersen => BusyBox
06-21-05 11:39 vsauder Issue Monitored: vsauder
06-21-05 11:52 vsauder Note Added: 0000250
07-18-05 15:12 pgf Note Added: 0000299
======================================================================
More information about the busybox-cvs
mailing list