Subject: Re: bin/3138: [dM] mkdep(1) always uses /usr/bin/gcc
To: None <netbsd-bugs@NetBSD.ORG>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 02/04/1997 14:34:28
>>> This would work without the -f; note that which(1) is required to
>>> use the user's .cshrc.

(Required by what?  Is there any standard for which?)

>> Why?  Not only is this dead wrong for non-csh users, I would argue
>> that it is wrong for csh users as well.  It appears that the csh
>> maintainer(s) agree with me; note that the csh which builtin does
>> NOT source .cshrc, so it's even inconsistent with that one now.

> Of course csh's builtin doesn't source .cshrc; csh has already *done*
> that.

But it may have done more than that.  If you set path in your .cshrc,
the path used by historic (and tree-current NetBSD) shell-script which
is the one set in your .cshrc, not the current one.  csh-builtin which
uses the current one.

These two paths are not necessarily the same.  You seem to be assuming
they are.

> which(1) needs to be run in an environment in which .cshrc has been
> sourced because it needs to pick up the user's csh aliases, which are
> (usually) defined in .cshrc.  That's the way it works.  That's the
> way it has always worked.

That's the way the current shell script works (and always has).  It is
not the way the current csh builtin works; the current csh builtin uses
the shell's current aliases and path, not the ones set in the .cshrc.

> As a result, /usr/bin/which is not an appropriate tool for finding a
> binary via $PATH.

This, I think, is what we wish to change.

> If you wish to implement such a tool, you should not call it 'which'.

Why not?  Essentially, what we ("we" = the people who want to replace
/usr/bin/which with something like Arne's C program) are proposing is
to redefine /usr/bin/which as a tool to locate a binary on $PATH.  This
is not identical to what the csh's builtin which works, but neither is
the current shellscript.  I, and apparently others, feel the historical
semantics of the shellscript are an accident of the first
implementation rather than being specifically desirable behavior, and
as such feel no particular need to preserve them.

					der Mouse

		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B