Subject: bug#14569: 24.3.50; bootstrap fails on Cygwin

From: Ken Brown <[email-masked]>
Date: Fri, 28 Jun 2013 08:20:34 -0400

On 6/27/2013 3:32 PM, Ken Brown wrote:
> On 6/27/2013 10:56 AM, Paul Eggert wrote:
>> On 06/24/2013 04:50 PM, Angelo Graziosi wrote:
>>> the bootstrap completed *without* errors!
>>
>> OK, thanks, as trunk bzr 113206 I installed a change
>> to skip the gnulib tickling on Cygwin.
>>
>> Although this should fix the bootstrap failure, I expect that
>> this reintroduces a bug into Cygwin Emacs, namely,
>> Emacs can sometimes lose track of subprocesses and/or kill off
>> unrelated processes; see Bug#12980 and Bug#8855.
>> Fixing this will require someone with access to Cygwin
>> and knowledge of how to debug threads under Cygwin,
>> neither of which I have.  Since the issue appears only
>> under Cygwin it could well be a Cygwin bug rather than an
>> Emacs or glib bug.
> 
> Another alternative is to replace
> 
>      if (! noninteractive || initialized)
> 
> by
> 
>      if (! noninteractive)
> 
> at least on Cygwin.  That allows the bootstrap to complete without 
> errors.  Assuming this doesn't cause other problems, we wouldn't have to 
> worry about reintroducing bugs into (interactive) Cygwin Emacs.

Just to be clear, here's what I'm proposing:

=== modified file 'src/process.c'
--- src/process.c       2013-06-27 14:47:52 +0000
+++ src/process.c       2013-06-28 11:30:42 +0000
@@ -7092,18 +7092,23 @@
   inhibit_sentinels = 0;

 #ifndef CANNOT_DUMP
+#ifdef CYGWIN
+  if (! noninteractive)
+#else
   if (! noninteractive || initialized)
 #endif
+#endif
     {
-#if defined HAVE_GLIB && !defined WINDOWSNT && !defined CYGWIN
+#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.

-        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).  */
+        For some reason tickling causes Cygwin bootstrap to fail, so
+        it's done under Cygwin only in the interactive case.  FIXME:
+        Skipping the tickling may cause bugs in subprocess handling
+        under Cygwin in the noninteractive case (Bug#14569).  */
       g_source_unref (g_child_watch_source_new (getpid ()));
 #endif
       catch_child_signal ();

Ken