On 19/10/2025 23:57, Collin Funk wrote:
Pádraig Brady <[email protected]> writes:

That flag is a no-op 
since:https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=ccfb2964and only 
there to allow old code to compile.

That change was after the clone implementation. It looks like before
then the POSIX_SPAWN_USEVFORK implementation actually used vfork which
would likewise use clone with CLONE_VM.

The default settings may be just fine these days,
though I've not looked into the details.

The default works well, that is what I used in my original message.
Gnulib's version uses vfork when POSIX_SPAWN_USEVFORK is used, which
might help other systems, though.

Oh right. I suppose the attr management isn't too onerous.

I was wondering if POSIX_SPAWN_USEVFORK was always defined,
but it seems so since gnulib's spawn-h module says:
"<spawn.h> is always overridden, because of GNULIB_POSIXCHECK".

I notice that glibc's posix_spawn() reaps the child itself upon exec error
(which I confirmed with `strace -ff`) but means we only get a single error
now from the following:

# Old behavior
  $ install src/install.c foo -s --strip-program=./foo
  install: cannot run './foo': Permission denied
  install: strip process terminated abnormally

# New behavior
  $ src/ginstall src/install.c foo -s --strip-program=./foo
  ginstall: cannot run './foo': Permission denied

That's fine though, and probably a slight improvement.

I'd add something in NEWS under "Improvements". Perhaps:

'install' now uses posix_spawn() to invoke the strip program more efficiently.

We can augment that message for sort(1) and split(1) if we make the change 
there too.

Otherwise the patch looks good.

thanks!
Padraig

Reply via email to