Subject: Re: bin/3138: [dM] mkdep(1) always uses /usr/bin/gcc
To: None <netbsd-bugs@NetBSD.ORG>
From: Christos Zoulas <christos@nyc.deshaw.com>
List: netbsd-bugs
Date: 02/01/1997 16:50:29
In article <Pine.GSO.3.95q.970201112939.339A-100000@shell.iag.net> tv@pobox.com (Todd Vierling) writes:
>On Fri, 31 Jan 1997, Chris G. Demetriou wrote:
>
>: > [ ... ]
>: > + if [ "$CC" = "" ]; then
>: > + CC=`which cc`
>: > + if [ "$CC" = "" ]; then
>: > + CC=`which gcc`
>: > [ ... ]
>:
>: use of 'which' is a fatal flaw in this patch.
>
>Funny; I don't see why. If you're worried about security, that's one thing
>(a root user should know his $PATH--this isn't setuid); if you're worried
>about compatibility, there should be no problem using which. The binary
>/usr/bin/which (which sh uses, instead of csh's builtin) works as this
>script uses it; if it finds cc/gcc, it prints only the first instance, and
>if it doesn't, it prints nothing.
Which is a nasty csh program. It sources your .cshrc with $prompt defined,
and checks each component of the path and aliases for the word(s) you pass
it. If you are not using csh this is losing.
A better fix is to add a whence builtin in the Bourne shell, but I still
don't like this much.
christos