[6105] in Athena Bugs

home help back first fref pref prev next nref lref last post

emacs fails to unmask SIGCHLD after vfork (emacs 18.54, all platforms)

daemon@ATHENA.MIT.EDU (Mark W. Eichin)
Tue Sep 25 23:31:40 1990

Date: Tue, 25 Sep 90 23:31:18 -0400
From: Mark W. Eichin <eichin@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
Cc: marc@ATHENA.MIT.EDU, web@ATHENA.MIT.EDU

Emacs 18.54 in version 7.1H, all architectures, has a bug which
interferes with zwgc under emacs (and any other asynchronous process
that forks.) 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.

				_Mark_ <eichin@athena.mit.edu>

ps. Please forward to the appropriate gnu lists; also, please inform
me of what is done with the change (it would be useful if it could
appear with the other emacs fix (for the killclient bug) if that goes
out...)

home help back first fref pref prev next nref lref last post