Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2002 08:30:01 -0800 (PST)
From:      Ahmon Dancy <dancy@dancysoft.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/16393: /bin/sh doesn't strip comments on shebang line
Message-ID:  <200202191630.g1JGU1Q33003@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/16393; it has been noted by GNATS.

From: Ahmon Dancy <dancy@dancysoft.com>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: bin/16393: /bin/sh doesn't strip comments on shebang line
Date: Tue, 19 Feb 2002 08:26:26 -0800

 We ran into a problem today related to this issue (we used the #
 character as switch to our program).  I did some studies on various
 other operating systems and FreeBSD hosts that have the modifications
 suggested by bin/16393 fall short.  Here are the results of my study:
 
 Given a file called '/tmp/x2' with shebang line:
 #!/tmp/interp -a -b -c #dee eee
 
 If /tmp/x2 is exec'd, the operating system runs /tmp/interp w/ the
 following arguments:
 
 Solaris 8:
 args: "/tmp/interp" "-a" "/tmp/x2"
 
 Tru64 4.0:
 args: "interp" "-a -b -c #dee eee" "/tmp/x2"
 
 FreeBSD 2.2.7:
 args: "/tmp/interp" "-a" "-b" "-c" "#dee" "eee" "/tmp/x2"
 
 FreeBSD 4.0:
 args: "/tmp/interp" "-a" "-b" "-c" "/tmp/x2"
 
 Linux 2.4.12:
 args: "/tmp/interp" "-a -b -c #dee eee" "/tmp/x2"
 
 Linux 2.2.19:
 args: "interp" "-a -b -c #dee eee" "/tmp/x2"
 
 Irix 6.5:
 args: "/tmp/interp" "-a -b -c #dee eee" "/tmp/x2"
 
 HPUX 11.00:
 args: "/tmp/x2" "-a -b -c #dee eee" "/tmp/x2"
 
 AIX 4.3:
 args: "interp" "-a -b -c #dee eee" "/tmp/x2"
 
 Mac OX X:
 args: "interp" "-a -b -c #dee eee" "/tmp/x2"
 
 
 The most common behavior is:
 argv[0]: full path of interpreter
 argv[1]: all remaining args, coalesced into one string
 argv[2]: The file file exec'd.
 
 FreeBSD's behavior is way out there.  No other system treats "#" in any special 
 way.
 
 
 

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?200202191630.g1JGU1Q33003>