]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
timeout: with --foreground don't send SIGCONT
authorPádraig Brady <P@draigBrady.com>
Wed, 13 May 2015 12:41:42 +0000 (13:41 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 13 May 2015 12:48:56 +0000 (13:48 +0100)
* src/timeout.c (cleanup): Don't send SIGCONT to the monitored program
when --foreground is specified, as it's generally not needed for
foreground programs, and can cause intermittent signal delivery
issues with monitors like GDB for example.
* doc/coreutils.texi (timeout invocation): Mention that SIGCONT
is not sent with --foreground.
* NEWS: Mention the behavior change.

NEWS
doc/coreutils.texi
src/timeout.c

diff --git a/NEWS b/NEWS
index 0fbd4ce6ef5a4b0de19ed008e08a417c5bd3f5b9..1d4b718b1736b23d60f57f3a59c7fc3b0985d950 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -92,6 +92,8 @@ GNU coreutils NEWS                                    -*- outline -*-
   tee does not treat the file operand '-' as meaning standard output any longer,
   for better conformance to POSIX.  This feature was added in coreutils-5.3.0.
 
+  timeout --foreground no longer sends SIGCONT to the monitored process,
+  which was seen to cause intermittent issues with GDB for example.
 
 ** Improvements
 
index 4ae06c30b973f2a5b4f046fafa985f107cc1639e..a7362b30c22ec805429dc9deef0ee95f92bbab1d 100644 (file)
@@ -16594,7 +16594,10 @@ from the terminal (like Ctrl-C for example)
 @end enumerate
 
 Note in this mode of operation, any children of @var{command}
-will not be timed out.
+will not be timed out.  Also SIGCONT will not be sent to @var{command},
+as it's generally not needed with foreground processes, and can
+cause intermittent signal delivery issues with programs that are monitors
+themselves (like GDB for example).
 
 @item -k @var{duration}
 @itemx --kill-after=@var{duration}
index 19c07653a944f04f1563eb04b80b8c407bb83f4c..98378f6f5a17c936d41f9c6389cc456cb1a860e1 100644 (file)
@@ -203,15 +203,17 @@ cleanup (int sig)
          in case it has itself become group leader,
          or is not running in a separate group.  */
       send_sig (monitored_pid, sig);
+
       /* The normal case is the job has remained in our
          newly created process group, so send to all processes in that.  */
       if (!foreground)
-        send_sig (0, sig);
-      if (sig != SIGKILL && sig != SIGCONT)
         {
-          send_sig (monitored_pid, SIGCONT);
-          if (!foreground)
-            send_sig (0, SIGCONT);
+          send_sig (0, sig);
+          if (sig != SIGKILL && sig != SIGCONT)
+            {
+              send_sig (monitored_pid, SIGCONT);
+              send_sig (0, SIGCONT);
+            }
         }
     }
   else /* we're the child or the child is not exec'd yet.  */