🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99135

emacs fails to unmask SIGCHLD after vfork

#99135
From: "Jonathan I. Kamens"
Date: Mon, 05 Nov 1990 09:57
44 lines
2039 bytes
(Bug report and fix originally from from Mark Eichin,
eichin@ATHENA.MIT.EDU.)

This bug is reported with respect to emacs version 18.54, but the
portion of code affected by the bug is almost completely unchanged in
18.55.

In process.c, create_process() (beginning line 895), there is first
code that does

#if defined (BSD) || defined (UNIPLUS)
  sigsetmask (1 << (SIGCHLD - 1));
#else /* ordinary USG */

Later,
    pid = vfork ();
    if (pid == 0)
      {
        ....
        child_setup_tty (xforkout);
        child_setup (xforkin, xforkout, xforkout, new_argv, env);
      }

Even later,
#if defined (BSD) || defined (UNIPLUS)
  sigsetmask (0);
#else /* ordinary USG */

Note that in the middle section (the code executed "inside" the
vfork()) the SIGCHLD is still masked out. This is inherited by the
child, and carries over the exec (within child_setup.) Thus anything
run from this code will have SIGCHLD masked, and never receive SIGCHLD
(typically used to reap <defunct> child processes.)

Fix: after the if (pid == 0), do a sigsetmask(0).

Workaround, until then: do a sigsetmask(0) in any program run this
way.

Jonathan Kamens			              USnail:
MIT Project Athena Quality Assurance		11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710
Technical Details
Message-ID: <9011050957.AA11036@pit-manager.MIT.EDU>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!PIT-MANAGER.MIT.EDU!jik

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,1a0ee6ef352f7906,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-11-05 01:57:50 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!PIT-MANAGER.MIT.EDU!jik
From: jik@PIT-MANAGER.MIT.EDU ("Jonathan I. Kamens")
Newsgroups: gnu.emacs.bug
Subject: emacs fails to unmask SIGCHLD after vfork
Message-ID: <9011050957.AA11036@pit-manager.MIT.EDU>
Date: 5 Nov 90 09:57:50 GMT
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: bug-tracker@athena.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 44
Approved: bug-gnu-emacs@prep.ai.mit.edu
Posted: Mon Nov  5 10:57:50 1990