[BusyBox-cvs] [BusyBox 0000007]: which and wd-located files

bugs at busybox.net bugs at busybox.net
Tue Jun 21 18:52:39 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:              06-21-2005 11:52 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.

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                          
======================================================================




More information about the busybox-cvs mailing list