bug-make
[Top][All Lists]
Advanced

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

[bug #63070] posix_spawn fails to run a child process.


From: Dmitry Goncharov
Subject: [bug #63070] posix_spawn fails to run a child process.
Date: Tue, 20 Sep 2022 20:55:27 -0400 (EDT)

Follow-up Comment #10, bug #63070 (project make):

In glibc-2.17 posix_spawn returns 0 whether POSIX_SPAWN_USEVFORK is set or
not.
When POSIX_SPAWN_USEVFORK is not set posix_spawn returns 0 and errno is 0.
When POSIX_SPAWN_USEVFORK is set posix_spawn returns 0 and errno is ENOEXEC.

However, today i realized one aspect that we overlooked. There is this
configure check which is supposed to disable posix_spawn.
Why was posix_spawn enabled on this box?

This is the configure check for posix_spawn.

++++
     AC_RUN_IFELSE([AC_LANG_SOURCE([[
       #include <spawn.h>
       #include <string.h>

       extern char **environ;

       int main() {
         char* path = strdup("./non-existent");
         char *argv[[2]];
         argv[[0]] = path;
         argv[[1]] =  0;
         return posix_spawn(0, path, 0, 0, argv, environ);
       }]])],
       [make_cv_synchronous_posix_spawn=no],
       [make_cv_synchronous_posix_spawn=yes],
       [make_cv_synchronous_posix_spawn="no (cross-compiling)"])]))
----

This check contains a memory leak of string "./non-existent". i specify
-fsanitize=leak and this leak causes the test to fail.
when the test fails configure mistakenly treats this failure as a posix_spawn
return code being non zero and enables posix_spawn.

We can fix this configure check and keep job.c intact.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63070>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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