+2013-06-27 Paul Eggert <eggert@cs.ucla.edu>
+
+ Do not tickle glib SIGCHLD handling if Cygwin (Bug#14569).
+ This mostly consists of undoing recent changes.
+ * callproc.c (Fcall_process):
+ * process.c (create_process):
+ Do not worry about catching SIGCHLD here, undoing previous change.
+ * nsterm.m (ns_term_init): Re-catch SIGCHLD, undoing previous change.
+ * process.c, process.h (catch_child_signal):
+ No longer extern if !NS_IMPL_GNUSTEP, undoing 06-22 change.
+ * process.c (catch_child_handler): Don't worry about being called
+ lazily and do not assume caller has blocked SIGCHLD, undoing
+ previous change. Move first-time stuff back to
+ init_process_emacs, undoing 06-22 change. If CYGWIN, do not
+ tickle glib, as that causes Cygwin bootstrap to fail. Do not
+ set lib_child_handler if it's already initialized, which may
+ help avoid problems on GNUStep.
+
2013-06-23 Paul Eggert <eggert@cs.ucla.edu>
A more-conservative workaround for Cygwin SIGCHLD issues (Bug#14569).
block_input ();
block_child_signal ();
- catch_child_signal ();
#ifndef WINDOWSNT
/* vfork, and prevent local vars from being clobbered by the vfork. */
futz with the SIGCHLD handler, but before Emacs forks any children.
This function's caller should block SIGCHLD. */
+#ifndef NS_IMPL_GNUSTEP
+static
+#endif
void
catch_child_signal (void)
{
struct sigaction action, old_action;
-
-#if !defined CANNOT_DUMP
- if (noninteractive && !initialized)
- return;
-#endif
-
-#ifndef NS_IMPL_GNUSTEP
- if (lib_child_handler)
- return;
-#endif
-
-#if defined HAVE_GLIB && !defined WINDOWSNT
- /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
- this should always fail, but is enough to initialize glib's
- private SIGCHLD handler, allowing the code below to copy it into
- LIB_CHILD_HANDLER.
-
- Do this here, rather than early in Emacs initialization where it
- might make more sense, to try to avoid bugs in Cygwin glib (Bug#14569). */
- {
- GSource *source = g_child_watch_source_new (getpid ());
- g_source_unref (source);
- }
-#endif
-
emacs_sigaction_init (&action, deliver_child_signal);
+ block_child_signal ();
sigaction (SIGCHLD, &action, &old_action);
eassert (! (old_action.sa_flags & SA_SIGINFO));
-#ifdef NS_IMPL_GNUSTEP
- if (old_action.sa_handler == deliver_child_signal)
- return;
-#endif
-
- lib_child_handler
- = (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN
- ? dummy_handler
- : old_action.sa_handler);
+ if (old_action.sa_handler != deliver_child_signal)
+ lib_child_handler
+ = (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN
+ ? dummy_handler
+ : old_action.sa_handler);
+ unblock_child_signal ();
}
\f
inhibit_sentinels = 0;
+#ifndef CANNOT_DUMP
+ if (! noninteractive || initialized)
+#endif
+ {
+#if defined HAVE_GLIB && !defined WINDOWSNT && !defined CYGWIN
+ /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
+ this should always fail, but is enough to initialize glib's
+ private SIGCHLD handler, allowing the code below to copy it into
+ LIB_CHILD_HANDLER.
+
+ For some reason tickling causes Cygwin bootstrap to fail, so it's
+ skipped under Cygwin. FIXME: Skipping the tickling likely causes
+ bugs in subprocess handling under Cygwin (Bug#14569). */
+ g_source_unref (g_child_watch_source_new (getpid ()));
+#endif
+ catch_child_signal ();
+ }
+
FD_ZERO (&input_wait_mask);
FD_ZERO (&non_keyboard_wait_mask);
FD_ZERO (&non_process_wait_mask);