all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 13086@debbugs.gnu.org, stephen_powell@optusnet.com.au
Subject: bug#13086: 24.2.50; Emacs seems to hang at w32proc.c:1126
Date: Thu, 06 Dec 2012 20:28:02 +0200	[thread overview]
Message-ID: <83ehj3ox1p.fsf@gnu.org> (raw)
In-Reply-To: <50C02815.1050002@cs.ucla.edu>

> Date: Wed, 05 Dec 2012 21:07:33 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: stephen_powell@optusnet.com.au, 13086@debbugs.gnu.org
> 
> > inflooping in that case is hardly a Good Thing, is it?
> > And neither is aborting when asserts are enabled.  Perhaps signaling
> > an error would be better.
> 
> If we can't fix the bug, perhaps signaling an error is the
> best we can do, but I'd rather fix the bug.  Generally speaking,
> if there's an internal programming error, Emacs aborts
> rather than signaling an error.

Yes, but we usually do that only if Emacs cannot possibly recover from
that internal error.  If Emacs _can_ continue, then we only abort via
eassert, so that a production version won't crash.  In this case, any
errno except EINTR can simply be ignored.  E.g., if waitpid was
somehow called to wait for a non-existing or wrong process, we don't
care about such a process anyway.

So how about the following change?

=== modified file 'src/sysdep.c'
--- src/sysdep.c	2012-12-03 21:42:12 +0000
+++ src/sysdep.c	2012-12-06 18:25:22 +0000
@@ -287,17 +287,20 @@ get_child_status (pid_t child, int *stat
      so that another thread running glib won't find them.  */
   eassert (0 < child);
 
-  while ((pid = waitpid (child, status, options)) < 0)
-    {
-      /* CHILD must be a child process that has not been reaped, and
-	 STATUS and OPTIONS must be valid.  */
-      eassert (errno == EINTR);
-
-      /* Note: the MS-Windows emulation of waitpid calls QUIT
-	 internally.  */
-      if (interruptible)
-	QUIT;
-    }
+  do {
+    pid = waitpid (child, status, options);
+    if (pid < 0)
+      {
+	/* CHILD must be a child process that has not been reaped, and
+	   STATUS and OPTIONS must be valid.  */
+	eassert (errno == EINTR);
+
+	/* Note: the MS-Windows emulation of waitpid calls QUIT
+	   internally.  */
+	if (errno == EINTR && interruptible)
+	  QUIT;
+      }
+  } while (pid < 0 && errno == EINTR);
 
   /* If successful and status is requested, tell wait_reading_process_output
      that it needs to wake up and look around.  */







  reply	other threads:[~2012-12-06 18:28 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-05  7:22 bug#13086: 24.2.50; Emacs seems to hang at w32proc.c:1126 Stephen Powell
2012-12-05 16:42 ` Eli Zaretskii
2012-12-05 19:28 ` Stephen Powell
2012-12-05 21:25   ` Eli Zaretskii
2012-12-06  2:04     ` Paul Eggert
2012-12-06  3:51       ` Eli Zaretskii
2012-12-06  5:07         ` Paul Eggert
2012-12-06 18:28           ` Eli Zaretskii [this message]
2012-12-06 20:18             ` Paul Eggert
2012-12-06 20:25               ` Eli Zaretskii
2012-12-06 20:36                 ` Paul Eggert
2012-12-06 20:39                   ` Eli Zaretskii
2012-12-06 20:48                     ` Eli Zaretskii
2012-12-06 21:36                       ` Paul Eggert
2012-12-07  6:22                         ` Eli Zaretskii
2012-12-07 17:54                           ` Paul Eggert
2012-12-07 18:57                             ` Eli Zaretskii
2012-12-06 20:57                     ` Paul Eggert
2012-12-07  6:46                       ` Eli Zaretskii
2012-12-07 16:48                         ` Ken Brown
2012-12-07 17:43                           ` Paul Eggert
2012-12-06  7:35         ` Paul Eggert
2012-12-06 18:41           ` Eli Zaretskii
2012-12-06  5:07 ` Stephen Powell
2012-12-06 19:10 ` Stephen Powell
2012-12-06 19:36   ` Eli Zaretskii
2012-12-06 19:48     ` Eli Zaretskii
2012-12-06 20:17 ` Stephen Powell
2012-12-06 20:36   ` Eli Zaretskii
2012-12-06 22:51 ` Stephen Powell
2012-12-07  6:43   ` Eli Zaretskii
2012-12-07  0:10 ` Stephen Powell
2012-12-07  6:44   ` Eli Zaretskii
2012-12-21 11:56   ` Eli Zaretskii
2012-12-23 17:12     ` Eli Zaretskii
2013-01-22 13:38   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83ehj3ox1p.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=13086@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=stephen_powell@optusnet.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.