[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#54667: 29.0.50; posix_spawn breaks emacs-gdb
From: |
Philipp Stephani |
Subject: |
bug#54667: 29.0.50; posix_spawn breaks emacs-gdb |
Date: |
Sun, 17 Apr 2022 20:53:26 +0200 |
> Am 01.04.2022 um 16:44 schrieb Robert Pluim <rpluim@gmail.com>:
>
>>>>>> On Fri, 1 Apr 2022 15:29:50 +0200, "Herman, Géza"
>>>>>> <geza.herman@gmail.com> said:
>
> Herman> I can confirm that it fixes the problem.
>
> Thanks, Iʼll see if I can get around to committing it this weekend.
>
> Herman> For reference, here's the patch:
> Herman>
> https://lists.gnu.org/archive/html/emacs-devel/2022-03/msg00067.html
>
> Herman> (Btw., according to this email thread, vfork is faster than
> Herman> posix_spawn on Linux, so maybe it'd make sense to use posix_spawn
> only
> Herman> on non-Linux platforms?)
>
> In emacs-28 we only use posix_spawn on macOS because its vork is
> sub-optimal. I donʼt remember the rationale for switching to using it
> everywhere, itʼs undoubtedly in the archives somewhere.
My reasoning back then was:
1. Using fork/vfork has a few pitfalls (can't call async-signal-unsafe
functions in the child process) that posix_spawn avoids (by not allowing
arbitrary code between fork and exec). Therefore, using posix_spawn is simpler
and more obviously correct.
2. Because posix_spawn offers less functionality than fork+exec, it could be
faster than the latter, e.g. by having it implemented in the kernel and
avoiding page table copies.
3. Since we only run CI on GNU/Linux, it's useful to have only one codepath on
all Unix-like systems so that issues that only appear on macOS are less likely
to go unnoticed.
These arguments are still mostly correct, but there are some counterpoints:
1. We need to keep the fork/vfork code path anyway since posix_spawn doesn't
allow us to correctly set up a pseudoterminal, so we still need to deal with
the pitfalls.
2. posix_spawn is indeed much faster on macOS, but not so on GNU/Linux. (I
think it's unnecessarily slowed down on GNU/Linux by what I consider a bug in
the POSIX standard.)
3. This is still true, but I'm not sure how much it matters given that the
implementations of posix_spawn are completely different on GNU/Linux and macOS.