[Python-ideas] Migration of /usr/bin/python to python3

random832 at fastmail.us random832 at fastmail.us
Thu Mar 12 16:51:06 CET 2015


On Thu, Mar 12, 2015, at 06:29, Andrew Barnert wrote:
> The earliest versions of Unix shbang processing were done in exec, but
> that turned out to lead to a variety of problems, so most stopped, and
> after a few decades, POSIX finally (in 2008) forbade it: exec must use
> the standard shell processor for anything that's not a recognized,
> loadable executable format.

Show me where POSIX defines "recognized, loadable executable format" to
exclude #! as a magic number with its usual behavior.

What the standard requires is that execvp and execlp treat what would be
a failure of the other members of the exec family of functions (i.e.
execve, execle, execv, execl), with [ENOEXEC] by falling back to sh.
However, shebang does not cause these other functions to fail with
[ENOEXEC], and therefore does not fall under this clause.

It does not forbid any processing from being done "in exec" (i.e. in
execve).


More information about the Python-ideas mailing list