Cygwin: posix_spawnp: don't fallback to sh

Per the discussion starting with
https://cygwin.com/pipermail/cygwin/2023-April/253495.html
stop falling back to sh if the file given to posix_spawnp
is no executable.

This is not necessarily the last word on it, given
https://www.austingroupbugs.net/view.php?id=1674, but for now,
opt for following the proposal in the Austin Group bug entry,
as well as PASSing the GNULIB test-posix_spawnp-script test.

Fixes: c7c1a1ca1b ("Add support for new posix_spawn function.")
Fixes: 3fbfcd11fb ("Cygwin: posix_spawn: add Cygwin-specific code fixing process synchronisation")
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2023-04-19 21:04:49 +02:00
parent 3124d8b436
commit da40bd6eaf
2 changed files with 8 additions and 2 deletions

View File

@ -26,3 +26,10 @@ What's new:
- New API calls: posix_spawn_file_actions_addchdir_np,
posix_spawn_file_actions_addfchdir_np.
What changed:
-------------
- posix_spawnp no longer falls back to starting the shell for unrecognized
files as execvp. For the reasoning, see
https://www.austingroupbugs.net/view.php?id=1674

View File

@ -1392,8 +1392,7 @@ __posix_spawn_execvpe (const char *path, char * const *argv, char *const *envp,
ch_spawn.set_sem (sem);
ch_spawn.worker (use_env_path ? (find_exec (path, buf, "PATH", FE_NNF) ?: "")
: path,
argv, envp,
_P_OVERLAY | (use_env_path ? _P_PATH_TYPE_EXEC : 0));
argv, envp, _P_OVERLAY);
__posix_spawn_sem_release (sem, errno);
return -1;
}