Subject: bin/13462: which(1) should not be implemented in csh(1)
To: None <gnats-bugs@gnats.netbsd.org>
From: Akinori MUSHA <knu@iDaemons.org>
List: netbsd-bugs
Date: 07/14/2001 22:49:34
>Number: 13462
>Category: bin
>Synopsis: which(1) should not be implemented in csh(1)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 14 06:47:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Akinori MUSHA
>Release: NetBSD 1.5.1
>Organization:
>Environment:
System: NetBSD typhon 1.5.1 NetBSD 1.5.1 (GENERIC) #56: Mon Jul 2 15:54:23 CEST 2001 he@nsa.uninett.no:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
which(1) should be not implemented in csh(1), because if you
invoke it indirectly from your ~/.cshrc, csh will go into
almost infinite loop. (In reality it stops when it uses up
system resource)
>How-To-Repeat:
Do the following:
$ cd
$
$ # first of all, backup your .cshrc
$ mv .cshrc .cshrc.bak
$
$ # create a bourne shell script that invokes /usr/bin/which
$ echo 'echo `which ls`' > foo
$ chmod +x foo
$
$ # let .cshrc run the command
$ echo '$HOME/foo' > ~/.cshrc
$
$ # ok, let's invoke csh..
$ csh
/home/knu/foo: Cannot fork
/bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls /bin/ls
% # ahh...
%
% # let's clean up
% exit
$ rm ~/foo
$ mv ~/.cshrc.bak ~/.cshrc
>Fix:
Reimplement which(1) in C or bourne shell. FreeBSD 5-CURRENT
has a C version, which you might want to import. Needless to
say, it's easy to implement one from scratch.
--
/
/__ __ Akinori.org / MUSHA.org
/ ) ) ) ) / FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp
"Freeze this moment a little bit longer, make each impression
a little bit stronger.. Experience slips away -- Time stand still"
>Release-Note:
>Audit-Trail:
>Unformatted: