bug-make
[Top][All Lists]
Advanced

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

Re: ENOEXEC from exec*() functions...?


From: Eli Zaretskii
Subject: Re: ENOEXEC from exec*() functions...?
Date: Mon, 30 Jul 2018 17:29:45 +0300

> From: Paul Smith <address@hidden>
> Date: Mon, 30 Jul 2018 06:47:38 -0400
> 
> I can't find a way to exercise this code path.
> 
> If the command being invoked doesn't have the executable bit set (e.g.,
> I use "touch ./foo" with the above) then exec() fails with errno set to
> EPERM not ENOEXEC, and if I make the script executable but without a #!
> line at the top then exec() runs it in a shell without returning
> ENOEXEC.
> 
> The GNU/Linux man page doesn't appear to allow this (a script that
> doesn't start with #!) or at least doesn't document it as valid, but it
> does work.  It lists ENOEXEC errno code as meaning:
> 
>   ENOEXEC
>          An  executable  is  not in a recognized format, is for the wrong
>          architecture, or has some other format error that means it  can‐
>          not be executed.
> 
> Which doesn't sound like something that would be helped by re-running
> as a shell script.  Maybe this is a feature of GNU/Linux and other
> systems use ENOEXEC when there's no #! line?

But in GNU Make, SHELL can be set to anything, including a command
that runs some executables which the Unix kernel and the Unix shell
don't recognize.  Maybe that code tries to cater to this situation?
AFAIU, such a situation will not be resolved by execvp's fallback to
the shell, because I presume execvp will call the standard shell,
right?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]