Hi Thomas,

If the argument is not an .exe, then it may be a command shell script  (.sh, etc.) Only the system knows it is not an exe (errno == ENOEXEC), so it then passes it as
the first argument to /bin/sh that will handle the shell files.

And yes, count me as a Reviewer and reviewed.

Roger

On 06/04/2019 12:14 PM, Thomas Stüfe wrote:

On Tue, Jun 4, 2019 at 5:09 PM Roger Riggs <roger.ri...@oracle.com <mailto:roger.ri...@oracle.com>> wrote:

...

Then I ran an strace over it and saw this:

5332 [pid  3911] execve("./sleep2", ["./sleep2"], [/* 78 vars */] <unfinished ...>                 .. 5342 [pid  3911] <... execve resumed> )      = -1 ENOEXEC (Exec format error) 5343 [pid  3911] execve("/bin/sh", ["/bin/sh", "./sleep2"], [/* 78 vars */] <unfinished ...>
5347 [pid  3911] <... execve resumed> )      = 0

So, if the first exec fails for whatever reason, we try again, passing the executable file name as argument to the system shell. This does not feel right? Do you know why we do this?


    Thanks, Roger


Thank you Roger. Can I consider the patch to be reviewed by you?
..Thomas


Reply via email to