From: Philipp Stephani <p.stephani2@gmail.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: 54667@debbugs.gnu.org, Géza <geza.herman@gmail.com>,
Herman@debbugs.gnu.org
Subject: bug#54667: 29.0.50; posix_spawn breaks emacs-gdb
Date: Sun, 17 Apr 2022 20:53:26 +0200 [thread overview]
Message-ID: <BB2B4F8B-E2AC-4016-8BB5-AFB365166129@gmail.com> (raw)
In-Reply-To: <87bkxk983m.fsf@gmail.com>
> 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.
prev parent reply other threads:[~2022-04-17 18:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 10:51 bug#54667: 29.0.50; posix_spawn breaks emacs-gdb Herman, Géza
2022-04-01 12:16 ` Robert Pluim
2022-04-01 13:29 ` Herman, Géza
2022-04-01 14:44 ` Robert Pluim
2022-04-04 14:11 ` Robert Pluim
2022-04-06 9:02 ` Robert Pluim
2022-04-06 11:09 ` Eli Zaretskii
2022-04-06 12:04 ` Robert Pluim
2022-04-06 12:21 ` Eli Zaretskii
2022-04-06 12:33 ` Robert Pluim
2022-04-06 15:48 ` Eli Zaretskii
2022-04-07 11:10 ` Robert Pluim
2022-04-17 18:53 ` Philipp Stephani [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BB2B4F8B-E2AC-4016-8BB5-AFB365166129@gmail.com \
--to=p.stephani2@gmail.com \
--cc=54667@debbugs.gnu.org \
--cc=Herman@debbugs.gnu.org \
--cc=geza.herman@gmail.com \
--cc=rpluim@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.