Current-Users archive

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

Re: posix_spawn issue?



On Sat, May 01, 2021 at 12:55:58PM +0200, Jaromír Doleček wrote:
> Le sam. 1 mai 2021 à 11:15, Martin Husemann <martin%duskware.de@localhost> a écrit :
> >
> > On Sat, May 01, 2021 at 11:02:26AM +0200, Thomas Klausner wrote:
> > > gmake since version 4.3 uses posix_spawn(), but that breaks the build
> > > of firefox (and libreoffice). Disabling posix_spawn() support in gmake
> > > works around this problem.[1]
> > >
> > > Is there a bug/incompatibility in our posix_spawn() or is there a bug
> > > in gmake?
> >
> > Hard to tell from the data available.
> >
> > We need a smaller test case reproducing the issue - debugging it in the
> > firefox build is not very practical.
> 
> Maybe one of the good steps would be getting more than 'error 127'
> from gmake for it.
> 
> I'd expect whatever incompatibility to be with an unsupported/wrongly
> working attributes, or file actions. Does gmake do anything odd for
> them?

The whole use of posix_spawn is limited to one file, src/job.c.

Some selected snippets from there:

#if defined(USE_POSIX_SPAWN)
      /* Some versions of posix_spawn() do not detect errors such as command
         not found until after they fork.  In that case they will exit with a
         code of 127.  Try to detect that and provide a useful error message.
         Otherwise we'll just show the error below, as normal.  */
      if (exit_sig == 0 && exit_code == 127 && c->cmd_name)
        {


...

#ifdef HAVE_POSIX_SPAWNATTR_SETSIGMASK
  {
    sigset_t mask;
    sigemptyset (&mask);
    r = posix_spawnattr_setsigmask (&attr, &mask);
    if (r != 0)
      goto cleanup;
    flags |= POSIX_SPAWN_SETSIGMASK;
  }
#endif /* have posix_spawnattr_setsigmask() */

  /* USEVFORK can give significant speedup on systems where it's available.  */
#ifdef POSIX_SPAWN_USEVFORK
  flags |= POSIX_SPAWN_USEVFORK;
#endif
...

  /* Be the user, permanently.  */
  flags |= POSIX_SPAWN_RESETIDS;

  /* Apply the spawn flags.  */
  if ((r = posix_spawnattr_setflags (&attr, flags)) != 0)
    goto cleanup;
...



The whole file is here:

https://git.savannah.gnu.org/cgit/make.git/tree/src/job.c

Cheers,
 Thomas


Home | Main Index | Thread Index | Old Index