diff options
author | Justine Tunney <jtunney@gmail.com> | 2021-01-25 21:34:50 -0800 |
---|---|---|
committer | Peter Stephenson <p.stephenson@samsung.com> | 2021-02-16 09:16:20 +0000 |
commit | 326d9c203b3980c0f841bc62b06e37134c6e51ea (patch) | |
tree | 07854fc13213a27825758d55ac2cfc273ef4f4b5 /Doc/Zsh/manual.yo | |
parent | 83cc7c6bf08762c3fdeb76a44e4086734ff1db13 (diff) | |
download | zsh-326d9c203b3980c0f841bc62b06e37134c6e51ea.tar.gz zsh-326d9c203b3980c0f841bc62b06e37134c6e51ea.tar.xz zsh-326d9c203b3980c0f841bc62b06e37134c6e51ea.zip |
Allow more scripts without #!
This change modifies the zsh binary safety check surrounding execve() so it can run shell scripts having concatenated binary content. We're using the same safety check as FreeBSD /bin/sh [1]. POSIX was recently revised to require this behavior: "The input file may be of any type, but the initial portion of the file intended to be parsed according to the shell grammar (XREF to XSH 2.10.2 Shell Grammar Rules) shall consist of characters and shall not contain the NUL character. The shell shall not enforce any line length limits." "Earlier versions of this standard required that input files to the shell be text files except that line lengths were unlimited. However, that was overly restrictive in relation to the fact that shells can parse a script without a trailing newline, and in relation to a common practice of concatenating a shell script ending with an 'exit' or 'exec $command' with a binary data payload to form a single-file self-extracting archive." [2] [3] One example use case of such scripts, is the Cosmopolitan C Library [4] which configuse the GNU Linker to output a polyglot shell+binary format that runs on Linux / Mac / Windows / FreeBSD / OpenBSD. [1] https://github.com/freebsd/freebsd-src/commit/9a1cd363318b7e9e70ef6af27d1675b371c16b1a [2] http://austingroupbugs.net/view.php?id=1250 [3] http://austingroupbugs.net/view.php?id=1226#c4394 [4] https://justine.lol/cosmopolitan/index.html
Diffstat (limited to 'Doc/Zsh/manual.yo')
0 files changed, 0 insertions, 0 deletions