I wrote:
> So, the ENOEXEC error is a bug in musl. But POSIX does not specify that the
> command interpreter for scripts without shebang is /bin/sh; therefore IMHO
> it would be good not to make this assumption.

Correction:
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html> says
  "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);

   where <shell path> is an unspecified pathname for the sh utility ..."

So, the command interpreter must be sh-compatible; only its file name is
unspecified.

=> We need to change 'useless-if-before-free' not because of POSIX,
but only because of the musl bug and/or for systems that are compliant
with older versions of POSIX (older than POSIX:2017).

Bruno


Reply via email to