Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jan 2001 18:11:00 -0800 (PST)
From:      larse@isi.edu
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/24769: tcsh: broken handling of comment in first line of shell script
Message-ID:  <200102010211.f112B0C72590@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         24769
>Category:       bin
>Synopsis:       tcsh: broken handling of comment in first line of shell script
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 31 18:20:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Lars Eggert
>Release:        4.2-RELEASE
>Organization:
>Environment:
FreeBSD hbo.isi.edu 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Wed Jan 31 02:09:17 PST 2001     root@hbo.isi.edu:/usr/src/sys/compile/KERNEL-1.12  i386

>Description:
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).
>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.


>Fix:
Workaround: Don't put a comment in the first line of a shell script.


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102010211.f112B0C72590>