From: Paul Eggert <eggert@cs.ucla.edu>
To: mituharu@math.s.chiba-u.ac.jp
Cc: emacs-devel@gnu.org
Subject: Re: SIGCHLD in vfork child context
Date: Sun, 21 May 2017 02:01:25 -0700 [thread overview]
Message-ID: <16e9a328-5bb7-3ff9-7cdd-0de4d263d65c@cs.ucla.edu> (raw)
In-Reply-To: <94d441f90dabb7c8e1cfe108903444b4.squirrel@weber.math.s.chiba-u.ac.jp>
[-- Attachment #1: Type: text/plain, Size: 123 bytes --]
mituharu@math.s.chiba-u.ac.jp wrote:
> Could you install a similar change to process.c, too?
Sure, done via the attached.
[-- Attachment #2: 0001-Work-around-macOS-bug-in-create_process-too.patch --]
[-- Type: text/x-patch, Size: 1039 bytes --]
From b1b570410f63e1f204677827530023ffc12218d6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 21 May 2017 02:00:02 -0700
Subject: [PATCH] Work around macOS bug in create_process, too
* src/process.c (create_process) [DARWIN_OS]:
Reset SIGCHLD after vfork here, too.
---
src/process.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/process.c b/src/process.c
index c301739..2a1c2ee 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2051,11 +2051,16 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
#ifdef DARWIN_OS
/* Darwin doesn't let us run setsid after a vfork, so use fork when
- necessary. */
+ necessary. Also, reset SIGCHLD handling after a vfork, as
+ apparently macOS can mistakenly deliver SIGCHLD to the child. */
if (pty_flag)
pid = fork ();
else
- pid = vfork ();
+ {
+ pid = vfork ();
+ if (pid == 0)
+ signal (SIGCHLD, SIG_DFL);
+ }
#else
pid = vfork ();
#endif
--
2.7.4
prev parent reply other threads:[~2017-05-21 9:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-13 5:41 SIGCHLD in vfork child context YAMAMOTO Mitsuharu
2017-05-15 1:04 ` YAMAMOTO Mitsuharu
2017-05-16 8:58 ` Paul Eggert
2017-05-16 9:19 ` Andreas Schwab
2017-05-16 9:50 ` Paul Eggert
2017-05-16 10:22 ` Andreas Schwab
2017-05-19 7:16 ` Paul Eggert
2017-05-19 3:19 ` YAMAMOTO Mitsuharu
2017-05-19 7:18 ` Paul Eggert
2017-05-20 8:22 ` YAMAMOTO Mitsuharu
2017-05-21 8:49 ` Paul Eggert
2017-05-21 8:53 ` mituharu
2017-05-21 9:01 ` Paul Eggert [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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16e9a328-5bb7-3ff9-7cdd-0de4d263d65c@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=mituharu@math.s.chiba-u.ac.jp \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).