Re: [PATCH] execve.2: add more detail about Shebangs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 22, 2019 at 12:24 AM Shawn Landden <shawn@xxxxxxx> wrote:
>
> Signed-off-by: Shawn Landden <shawn@xxxxxxx>
> ---
>  man2/execve.2 | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/man2/execve.2 b/man2/execve.2
> index a052f34b0..c363214c0 100644
> --- a/man2/execve.2
> +++ b/man2/execve.2
> @@ -336,6 +336,14 @@ For portable use,
>  should either be absent, or be specified as a single word (i.e., it
>  should not contain white space); see NOTES below.
>  .PP
> +The maximum length of the shebang line is 128 bytes,
This is already documented with the phrase "A maximum line length of
127 characters is allowed for the first line in an interpreter
script".

Moreover, this is likely going to change in Linux 5.1, due to the
commit v5.1-rc1~118^2~33 ("exec: increase BINPRM_BUF_SIZE to 256").

>  and excess bytes will be truncated.
> +.\" https://lwn.net/Articles/779997/ The case of the supersized shebang
> +The interpreter is passed the absolute filename to the file. There is no way to get the argv[0]
> +that was passed to the kernel via execve(2).
> +.\" See the P - preserve-argv[0] option.
> +.\" Documentation/admin-guide/binfmt-misc.rst
> +.\" https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
> +.PP
>  Since Linux 2.6.28,
>  .\" commit bf2a9a39639b8b51377905397a5005f444e9a892
>  the kernel permits the interpreter of a script to itself be a script.
> --
> 2.20.1
>


-- 
Eugene Syromyatnikov
mailto:evgsyr@xxxxxxxxx
xmpp:esyr@jabber.{ru|org}



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux