New submission from Stéphane Glondu: Hello,
According to [1], "In the cases where the other members of the exec family of functions would fail and set errno to [ENOEXEC], the execlp() and execvp() functions shall execute a command interpreter and the environment of the executed command shall be as if the process invoked the sh utility using execl() as follows: execl(<shell path>, arg0, file, arg1, ..., (char *)0);" This is not the case with os.execvp which keeps looking in PATH for other executables. To reproduce: 1. pick some executable that exists in /usr/bin (let's say "curl") 2. prepend to PATH a directory where you put an executable file with name "curl" and some random shell commands, without the #! line 3. run os.execvp("curl", ["curl"]) Instead of running the #!-less shell script, /usr/bin/curl is executed. With GNU libc's execvp(), the shell script is executed. According to my interpretation of POSIX, the shell script should be executed. [1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01_01 Cheers, -- Stéphane ---------- components: Library (Lib) messages: 205819 nosy: glondu priority: normal severity: normal status: open title: POSIX semantics of PATH search in execvpe is not respected type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19948> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com