Bug 10250

Summary: RHL 6.1 "which" command and man page are dangerously erroneous.
Product: [Retired] Red Hat Linux Reporter: swear
Component: whichAssignee: Preston Brown <pbrown>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-05-14 20:48:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description swear 2000-03-19 20:14:23 UTC
The man page says "it prints to stdout the full path of the executables
that would have been executed when [SHOULD BE "if"] this argument had
been entered at the shell prompt". But if "kill" is entered at the bash
shell prompt, the reported "/bin/kill" will NOT be executed, because
bash will run it's own kill command which has different options.

Either the command or the man page is wrong.  If the command can't be
changed, then the man page should provide warning in both the
"Description" and the "Bugs" sections.

Comment 1 Jeff Johnson 2000-05-14 20:48:59 UTC
The nuance of difference between "if" and "when" is carefully noted, but
hardly seems to be a crucial point.

Reading further in the man page shows how to use
    alias which='alias | which --tty-only --read-alias --show-tilde --show-dot'
in order to detect (at least) aliased commands, and a little thought should
provide a mechanism for detecting builtins as well, if that's your pleasure.
Meanwhile, the existing which(1) is superior to the traditional implementation
of which in a csh script, and the behavior is dictated more by conformance with
tradition than logic.