Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Nov 2001 07:49:10 -0800 (PST)
From:      Magnus Backstrom <b@etek.chalmers.se>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/32106: Scripts with #!/interpreter paths longer than 64 bytes don't work.
Message-ID:  <200111191549.fAJFnAl10476@freefall.freebsd.org>

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

>Number:         32106
>Category:       kern
>Synopsis:       Scripts with #!/interpreter paths longer than 64 bytes don't work.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 19 07:50:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Magnus Backstrom
>Release:        4.4-STABLE and 5.0-CURRENT
>Organization:
Chalmers UofT
>Environment:
FreeBSD j0.etek.chalmers.se 4.4-STABLE FreeBSD 4.4-STABLE #0: Thu Nov  1 09:35:50 CET 2001     b@j0.etek.chalmers.se:/usr/src/sys/compile/J0  i386
>Description:
If an interpreter pathname is longer than about 64 characters, i.e.
#!/you/have/a/slightly/longer/than/usual/path/to/your/interpreter,
/bin/sh gets used instead and your script may break.

>How-To-Repeat:
x> mkdir -p /tmp/this/is/a/slightly/too/long/path/to/the/interpreter
x> ln -s /usr/bin/awk \
    /tmp/this/is/a/slightly/too/long/path/to/the/interpreter
x> cat > /tmp/test.awk
#!/tmp/this/is/a/slightly/too/long/path/to/the/interpreter/awk -f
{ 1 }
x> chmod +x /tmp/test.awk 
x> /tmp/test.awk 
{: Command not found.
x> 

>Fix:
Change line 39 of /usr/src/sys/sys/imgact.h from
#define MAXSHELLCMDLEN  64
to something more sensible, e g
#define MAXSHELLCMDLEN  512
This doesn't seem to break anything.

>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?200111191549.fAJFnAl10476>