Bug 24769

Summary: tcsh: broken handling of comment in first line of shell script
Product: Base System Reporter: larse <larse>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
smime.p7s none

Description larse 2001-02-01 02:20:01 UTC
Tcsh has a bug in 4.2-RELEASE when the first line of a shell script
(which can contain the command interpreter, specified by #!) contains
a comment that is not a valid command interpreter.

In that case, tcsh will try to use the (non-existing) binary
/usr/obj/usr/src/i386/bin/csh (which looks like it got hardwired during
the 4.2 release buildworld).

Fix: 

Workaround: Don't put a comment in the first line of a shell script.
How-To-Repeat: The following shell script demonstrates the problem:

--snip--
# comment
echo bar
--snip--

[larse@hbo: ~] echo "# comment\necho bar" > bug && chmod +x bug && ./bug
/usr/obj/usr/src/i386/bin/csh: No such file or directory.
Comment 1 larse 2001-02-01 02:50:19 UTC
Snooping around the CVS tree, it seems this problem has been fixed in
-CURRENT with this patch:
http://www.FreeBSD.org/cgi/cvsweb.cgi/src/bin/csh/Makefile.diff?r1=1.21&r2=1.22

Will this be MFC'ed anytime soon?
-- 
Lars Eggert <larse@isi.edu>                 Information Sciences Institute
http://www.isi.edu/larse/                University of Southern California
Comment 2 mpp freebsd_committer freebsd_triage 2001-03-23 23:48:33 UTC
State Changed
From-To: open->closed

This problem was fixed in -current in rev 1.22, and in -stable 
in rev 1.11.2.5 on 3/4/01.