aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-06-27 07:47:52 -0700
committerPaul Eggert2013-06-27 07:47:52 -0700
commitdae2f5ef41cd81c4feeddb3667c03d1f27df7743 (patch)
treeb60602ea129e7ed6b7bd43f12d2a1d5db72ac027 /src
parent79f38c4eee230ca8d888e6babf98d5a1ad9bcb5f (diff)
downloademacs-dae2f5ef41cd81c4feeddb3667c03d1f27df7743.tar.gz
emacs-dae2f5ef41cd81c4feeddb3667c03d1f27df7743.zip
Do not tickle glib SIGCHLD handling if Cygwin.
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog18
-rw-r--r--src/callproc.c1
-rw-r--r--src/nsterm.m6
-rw-r--r--src/process.c63
-rw-r--r--src/process.h2
5 files changed, 54 insertions, 36 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6357491725d..837d946a26e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,21 @@
12013-06-27 Paul Eggert <eggert@cs.ucla.edu>
2
3 Do not tickle glib SIGCHLD handling if Cygwin (Bug#14569).
4 This mostly consists of undoing recent changes.
5 * callproc.c (Fcall_process):
6 * process.c (create_process):
7 Do not worry about catching SIGCHLD here, undoing previous change.
8 * nsterm.m (ns_term_init): Re-catch SIGCHLD, undoing previous change.
9 * process.c, process.h (catch_child_signal):
10 No longer extern if !NS_IMPL_GNUSTEP, undoing 06-22 change.
11 * process.c (catch_child_handler): Don't worry about being called
12 lazily and do not assume caller has blocked SIGCHLD, undoing
13 previous change. Move first-time stuff back to
14 init_process_emacs, undoing 06-22 change. If CYGWIN, do not
15 tickle glib, as that causes Cygwin bootstrap to fail. Do not
16 set lib_child_handler if it's already initialized, which may
17 help avoid problems on GNUStep.
18
12013-06-23 Paul Eggert <eggert@cs.ucla.edu> 192013-06-23 Paul Eggert <eggert@cs.ucla.edu>
2 20
3 A more-conservative workaround for Cygwin SIGCHLD issues (Bug#14569). 21 A more-conservative workaround for Cygwin SIGCHLD issues (Bug#14569).
diff --git a/src/callproc.c b/src/callproc.c
index 7db984fa71c..f0aa8222342 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -613,7 +613,6 @@ usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) *
613 613
614 block_input (); 614 block_input ();
615 block_child_signal (); 615 block_child_signal ();
616 catch_child_signal ();
617 616
618#ifdef WINDOWSNT 617#ifdef WINDOWSNT
619 pid = child_setup (filefd, fd1, fd_error, new_argv, 0, current_dir); 618 pid = child_setup (filefd, fd1, fd_error, new_argv, 0, current_dir);
diff --git a/src/nsterm.m b/src/nsterm.m
index c88e5034d39..93f693fe55e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4360,6 +4360,12 @@ ns_term_init (Lisp_Object display_name)
4360 4360
4361 [NSApp run]; 4361 [NSApp run];
4362 ns_do_open_file = YES; 4362 ns_do_open_file = YES;
4363
4364#ifdef NS_IMPL_GNUSTEP
4365 /* GNUstep steals SIGCHLD for use in NSTask, but we don't use NSTask.
4366 We must re-catch it so subprocess works. */
4367 catch_child_signal ();
4368#endif
4363 return dpyinfo; 4369 return dpyinfo;
4364} 4370}
4365 4371
diff --git a/src/process.c b/src/process.c
index 3f062b6db16..b63a985fcec 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1685,7 +1685,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1685 1685
1686 block_input (); 1686 block_input ();
1687 block_child_signal (); 1687 block_child_signal ();
1688 catch_child_signal ();
1689 1688
1690#ifndef WINDOWSNT 1689#ifndef WINDOWSNT
1691 /* vfork, and prevent local vars from being clobbered by the vfork. */ 1690 /* vfork, and prevent local vars from being clobbered by the vfork. */
@@ -7061,48 +7060,24 @@ integer or floating point values.
7061 futz with the SIGCHLD handler, but before Emacs forks any children. 7060 futz with the SIGCHLD handler, but before Emacs forks any children.
7062 This function's caller should block SIGCHLD. */ 7061 This function's caller should block SIGCHLD. */
7063 7062
7063#ifndef NS_IMPL_GNUSTEP
7064static
7065#endif
7064void 7066void
7065catch_child_signal (void) 7067catch_child_signal (void)
7066{ 7068{
7067 struct sigaction action, old_action; 7069 struct sigaction action, old_action;
7068
7069#if !defined CANNOT_DUMP
7070 if (noninteractive && !initialized)
7071 return;
7072#endif
7073
7074#ifndef NS_IMPL_GNUSTEP
7075 if (lib_child_handler)
7076 return;
7077#endif
7078
7079#if defined HAVE_GLIB && !defined WINDOWSNT
7080 /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
7081 this should always fail, but is enough to initialize glib's
7082 private SIGCHLD handler, allowing the code below to copy it into
7083 LIB_CHILD_HANDLER.
7084
7085 Do this here, rather than early in Emacs initialization where it
7086 might make more sense, to try to avoid bugs in Cygwin glib (Bug#14569). */
7087 {
7088 GSource *source = g_child_watch_source_new (getpid ());
7089 g_source_unref (source);
7090 }
7091#endif
7092
7093 emacs_sigaction_init (&action, deliver_child_signal); 7070 emacs_sigaction_init (&action, deliver_child_signal);
7071 block_child_signal ();
7094 sigaction (SIGCHLD, &action, &old_action); 7072 sigaction (SIGCHLD, &action, &old_action);
7095 eassert (! (old_action.sa_flags & SA_SIGINFO)); 7073 eassert (! (old_action.sa_flags & SA_SIGINFO));
7096 7074
7097#ifdef NS_IMPL_GNUSTEP 7075 if (old_action.sa_handler != deliver_child_signal)
7098 if (old_action.sa_handler == deliver_child_signal) 7076 lib_child_handler
7099 return; 7077 = (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN
7100#endif 7078 ? dummy_handler
7101 7079 : old_action.sa_handler);
7102 lib_child_handler 7080 unblock_child_signal ();
7103 = (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN
7104 ? dummy_handler
7105 : old_action.sa_handler);
7106} 7081}
7107 7082
7108 7083
@@ -7116,6 +7091,24 @@ init_process_emacs (void)
7116 7091
7117 inhibit_sentinels = 0; 7092 inhibit_sentinels = 0;
7118 7093
7094#ifndef CANNOT_DUMP
7095 if (! noninteractive || initialized)
7096#endif
7097 {
7098#if defined HAVE_GLIB && !defined WINDOWSNT && !defined CYGWIN
7099 /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
7100 this should always fail, but is enough to initialize glib's
7101 private SIGCHLD handler, allowing the code below to copy it into
7102 LIB_CHILD_HANDLER.
7103
7104 For some reason tickling causes Cygwin bootstrap to fail, so it's
7105 skipped under Cygwin. FIXME: Skipping the tickling likely causes
7106 bugs in subprocess handling under Cygwin (Bug#14569). */
7107 g_source_unref (g_child_watch_source_new (getpid ()));
7108#endif
7109 catch_child_signal ();
7110 }
7111
7119 FD_ZERO (&input_wait_mask); 7112 FD_ZERO (&input_wait_mask);
7120 FD_ZERO (&non_keyboard_wait_mask); 7113 FD_ZERO (&non_keyboard_wait_mask);
7121 FD_ZERO (&non_process_wait_mask); 7114 FD_ZERO (&non_process_wait_mask);
diff --git a/src/process.h b/src/process.h
index 3f86e5f3945..e7ee5f9adde 100644
--- a/src/process.h
+++ b/src/process.h
@@ -219,6 +219,8 @@ extern void add_read_fd (int fd, fd_callback func, void *data);
219extern void delete_read_fd (int fd); 219extern void delete_read_fd (int fd);
220extern void add_write_fd (int fd, fd_callback func, void *data); 220extern void add_write_fd (int fd, fd_callback func, void *data);
221extern void delete_write_fd (int fd); 221extern void delete_write_fd (int fd);
222#ifdef NS_IMPL_GNUSTEP
222extern void catch_child_signal (void); 223extern void catch_child_signal (void);
224#endif
223 225
224INLINE_HEADER_END 226INLINE_HEADER_END