lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 3 Dec 2008 15:56:50 +0000
From:	"Américo Wang" <xiyou.wangcong@...il.com>
To:	Geralt <usr.gentoo@...glemail.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Shebang - why are parameters not splitted on whitespace?

On Wed, Dec 3, 2008 at 3:14 PM, Geralt <usr.gentoo@...glemail.com> wrote:
> Hi,
>
> I've just noticed, that it's not possible to use more than one
> parameter in a shebang on linux, because everything following the
> executable path in the shebang is treated as one parameter, so for
> example
> #!/bin/awk --re-interval -f
> in a script called "test.awk" results in a call likes this:
> /bin/awk "--re-interval -f" ./test.awk
> when running it with "./test.awk".
>
> Is there any reason why the parameters are not split before passing
> them on to the program?


Hello,

I think this behavior is different on different platforms, you can
find some clues
in man page of execve(2):

       The  semantics  of  the  optional-arg argument of an interpreter script
       vary across implementations.  On Linux, the entire string following the
       interpreter name is passed as a single argument to the interpreter, and
       this string can include white space.  However, behavior differs on some
       other  systems.   Some  systems  use the first white space to terminate
       optional-arg.  On some systems, an interpreter script can have multiple
       arguments,  and  white  spaces  in optional-arg are used to delimit the
       arguments

It seems that POSIX doesn't specify this.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ