https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=da40bd6eaf400e102fca68cbe170465a4af6d49c
commit da40bd6eaf400e102fca68cbe170465a4af6d49c Author: Corinna Vinschen <[email protected]> AuthorDate: Wed Apr 19 21:04:49 2023 +0200 Commit: Corinna Vinschen <[email protected]> CommitDate: Wed Apr 19 21:08:48 2023 +0200 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: c7c1a1ca1b33 ("Add support for new posix_spawn function.") Fixes: 3fbfcd11fb09 ("Cygwin: posix_spawn: add Cygwin-specific code fixing process synchronisation") Reported-by: Bruno Haible <[email protected]> Signed-off-by: Corinna Vinschen <[email protected]> Diff: --- winsup/cygwin/release/3.5.0 | 7 +++++++ winsup/cygwin/spawn.cc | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/release/3.5.0 b/winsup/cygwin/release/3.5.0 index f7c267616ee4..c8485b18c507 100644 --- a/winsup/cygwin/release/3.5.0 +++ b/winsup/cygwin/release/3.5.0 @@ -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 diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 4d0ca127b944..84dd74e28fed 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -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; }
