Subject: Re: bin/10611: /usr/bin/which reads user's .chsrc even if user's shell is not csh
To: None <p99dreyf@criens.u-psud.fr>
From: Chris G. Demetriou <cgd@sibyte.com>
List: netbsd-bugs
Date: 07/16/2000 19:30:00
p99dreyf@criens.u-psud.fr writes:
> /usr/bin/which is a csh script. It does read ~/.cshrc. If .cshrc is
> buggy, the user will get strange behavior. This is espacially a problem
> if the user does not use csh: she will never notice that the problem
> comes from .cshrc
> 
> >How-To-Repeat:
> Be a ksh user. Create a buggy .cshrc (bad commands for instance), try to
> run which, you get an error

This is the correct, documented, and historical behaviour for the
'which' script.

Yes, if you're not a csh user it may seem less than optimal... but
it's the way that which has always worked, and changing it will cause
serious problems for people who have gotten used to using it.  (in
particular, if it doesn't source the user's cshrc, it can't
necessarily figure out aliases, etc.)

the ksh equivalent is a shell builtin, 'whence'.


cgd