Subject: Re: bin/10611: /usr/bin/which reads user's .chsrc even if user's shell is not csh
To: Todd Whitesel <>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 07/19/2000 18:51:42
    Date:        Tue, 18 Jul 2000 23:53:08 -0700 (PDT)
    From:        Todd Whitesel <>
    Message-ID:  <>

  | +This is arguably wrong, but it is the historically established behavior.

It isn't arguably wrong, or just done for hysterical reasons - it is
essential to the correct operation of which.   The purpose of "which"
is to allow csh users to find out what will happen if they type some
command.  For that to work, it has to be able to find the user's aliases,
path setting, etc, and while it isn't perfect (it doesn't find anything altered
in the current shell) sourcing the user's cshrc is the way that is done.

When invented, it would have been better if which had been made a builtin
command in csh - then it would have worked properly (including seeing all
current available aliases, etc) and also would have avoided tempting users
of other shells into thinking they could sensibly use it for anything.

Today, the best solution is probably
	rm -fr /usr/src/bin/csh /usr/src/usr.bin/which /usr/pkgsrc/shells/tcsh


ps: avoid the flames - I have no expectation that anyone is about to go 
execute the above command...