Subject: bin/34114: which doesn't handle commands given as pathnames
To: None <,>
From: None <>
List: netbsd-bugs
Date: 07/30/2006 11:00:01
>Number:         34114
>Category:       bin
>Synopsis:       which doesn't handle commands given as pathnames
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 30 11:00:01 +0000 2006
>Originator:     Michael van Elst
>Release:        NetBSD 3.0_STABLE
                                Michael van Elst
                                "A potential Snark may lurk in every tree."
System: NetBSD henery 3.0_STABLE NetBSD 3.0_STABLE (HENERY) #34: Mon Jul 24 19:54:43 CEST 2006 src@henery:/usr/obj/home/src/sys/arch/i386/compile/HENERY i386
Architecture: i386
Machine: i386
NetBSD's command /usr/bin/which only searches for command names in the
command search path, showing the absolute path to the executable.

Every other system has a slightly different semantic and searches for
a command and reports the absolute path to the executable that would
have been used when the command had been passed to a shell.

The difference is that there a command given with its absolute 
path is found while it isn't with NetBSD's which.

Our csh builtin 'which' on the other hand is compatible.


% which man
% which /usr/bin/man
% which nonexistent
nonexistent: Command not found.
% which /usr/bin/nonexistent
/usr/bin/nonexistent: Command not found.

% /usr/bin/which man
% /usr/bin/which /usr/bin/man
% /usr/bin/which nonexistent
% /usr/bin/which /usr/bin/nonexistent