Subject: Re: bug#8705: 23.3; Emacs occasionally crashes (segfault) just after starting it

From: Troels Nielsen <[email-masked]>
Date: Sat, 7 Jul 2012 17:08:18 +0200

> Better yet, we can use posix_spawn, falling back to gnulib's
> implementation of posix_spawn in terms of fork or vfork. Unfortunately,
> posix_spawn has no way of telling the child to setsid, so the best we
> could do would be setpgrp. I have patches to use posix_spawn in the
> call_process case, but not the async case.
>
> I'm not entirely sure how much of a difference avoiding setsid makes. In
> the meantime, retaining support for vfork would be nice, because on some
> platforms, like Cygwin, fork is still very slow.
>

Yes, looking into the problem more deeply I realize that the patch is
wrong. In fact it only substitutes one race condition for a more
severe one.

posix_spawn may be the right thing but I don't know how broadly available it is.

Another possibility would be using vfork+execle, as far as I can see
it is standardized, has been available for quite some time and it
won't make problems with setsid. The use of execvp is likely just due
to the age of these parts.

Regards
Troels