Good morning. Certian implementations of posix_spawn return 0 on failure and then exit the child process with 127. I observed this with older glibc (2.12) and on aix.
This results in gmake not printing related error message "no such file" or "permission denied" when the command is missing or not executable. This also causes multiple tests to fail. $ echo 'all: ; @./foo' > /tmp/1.mk $ ./make-4.2.90 -f /tmp/1.mk make-4.2.90: *** [/tmp/1.mk;1: all] Error 127 $ ./make.patched -f /tmp/1.mk make.patched: ./foo: No such file or directory make.patched: *** [/tmp/1.mk;1: all] Error 127 This patch executes posix_spawnp at configuration time and then disables posix_spawn if posix_spawn returns 0 on an attempt to exec a missing file. This solution won't work for cross compilation. regards, Dmitry index f6919a7..9da113c 100644 --- a/configure.ac +++ b/configure.ac @@ -142,7 +142,7 @@ AC_CHECK_FUNCS([strdup strndup umask mkstemp mktemp fdopen \ dup dup2 getcwd realpath sigsetmask sigaction \ getgroups seteuid setegid setlinebuf setreuid setregid \ getrlimit setrlimit setvbuf pipe strsignal \ - lstat readlink atexit isatty ttyname pselect posix_spawn \ + lstat readlink atexit isatty ttyname pselect posix_spawn posix_spawnp \ posix_spawnattr_setsigmask]) # We need to check declarations, not just existence, because on Tru64 this @@ -368,7 +368,18 @@ AC_ARG_ENABLE([posix-spawn], AS_CASE([/$ac_cv_header_spawn/$ac_cv_func_posix_spawn/], [*/no/*], [make_cv_posix_spawn=no]) -AS_CASE([/$make_cv_posix_spawn/$user_posix_spawn/], +AC_RUN_IFELSE( + [AC_LANG_PROGRAM([ + #include <spawn.h> + #include <errno.h>], [ + char* av[[]] = {"./macarie", '\0'}; + char* envp[[]] = {'\0'}; + return posix_spawnp(0, av[[0]], 0, 0, av, envp) != ENOENT; ])], + [posix_spawn_is_good="yes"], + [posix_spawn_is_good="no"] +) + +AS_CASE([/$make_cv_posix_spawn/$user_posix_spawn/$posix_spawn_is_good/], [*/no/*], [make_cv_posix_spawn=no], [AC_DEFINE(USE_POSIX_SPAWN, 1, [Define to 1 to use posix_spawn().]) ]) _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make