[Top][All Lists]

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

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

From: Paul Smith
Subject: Re: ENOEXEC from exec*() functions...?
Date: Mon, 30 Jul 2018 07:56:52 -0400

On Mon, 2018-07-30 at 13:16 +0200, Andreas Schwab wrote:
> On Jul 30 2018, Paul Smith <address@hidden> wrote:
> > 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?
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/execve.html
>     There are two distinct ways in which the contents of the process
>     image file may cause the execution to fail, distinguished by the
>     setting of errno to either [ENOEXEC] or [EINVAL] (see the ERRORS
>     section). 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);

Aha.  GNU make is using execvp() so that explains that.  Maybe the
original code was using a different form of exec().

So it sounds like this code in GNU make is redundant, assuming a POSIX-
compliant implementation of execvp().

I wasn't able to find any similar text in the posix_spawn() document
although posix_spawnp() does appear to behave the same way as execvp()
on GNU/Linux (not surprising since I believe posix_spawn() is
implemented in terms of fork/exec there).

Thanks Andreas!

reply via email to

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