Your message dated Sat, 18 May 2013 10:13:15 +0300 (EEST)
with message-id <[email protected]>
and subject line Bug #399769 filed against the timeout package
has caused the Debian Bug report #399769,
regarding timeout: bad support for processes which use a process group
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
399769: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399769
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: timeout
Version: 1.11-6.2
Tags: patch

The timeout command has a bug which occures when the spawned process sends a 
signal to process group.

The bad output:

$ timeout 5 sh -c 'kill 0'; echo $?
Timeout: aborting command ``sh'' with signal 9
Killed
137

I would like to do a NMU with solution for this bug and Bug#187092.

-- 
 .''`.    Piotr Roszatycki
: :' :    mailto:[email protected]
`. `'     
   `-
--- timeout.c.orig	2001-09-09 23:46:10.000000000 +0200
+++ timeout.c	2006-11-21 21:40:47.000000000 +0100
@@ -34,6 +34,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
+#include <sys/wait.h>
 
 extern int optind;
 
@@ -41,6 +42,7 @@
 
 #define perrorexit(s) { perror(s); exit(1); }
 
+static pid_t child_pid;
 static int kill_signal = SIGKILL;
 static char *progname;
 static char *commandname;
@@ -55,9 +57,16 @@
 int     sig;
 {
     signal(kill_signal, SIG_DFL);
-    fprintf(stderr, "Timeout: aborting command ``%s'' with signal %d\n",
-	    commandname, kill_signal);
-    kill(0, kill_signal);
+    if (sig == SIGALRM) {
+	fprintf(stderr, "Timeout: aborting command ``%s'' with signal %d\n",
+		commandname, kill_signal);
+    }
+    else {
+	fprintf(stderr, "Got signal %d: aborting command ``%s'' with signal %d\n",
+		sig, commandname, kill_signal);
+    }
+    kill(-child_pid, kill_signal);
+    exit(-1);
 }
 
 int     main(argc, argv)
@@ -66,7 +75,6 @@
 {
     int     time_to_run;
     pid_t   pid;
-    pid_t   child_pid;
     int     status;
 
     progname = argv[0];
@@ -87,11 +95,11 @@
      * Run the command and its watchdog in a separate process group so that
      * both can be killed off with one signal.
      */
-    setsid();
     switch (child_pid = fork()) {
     case -1:					/* error */
 	perrorexit("timeout: fork");
     case 00:					/* run controlled command */
+	setsid();
 	execvp(argv[1], argv + 1);
 	perrorexit(argv[1]);
     default:					/* become watchdog */
@@ -99,10 +107,14 @@
 	(void) signal(SIGINT, terminate);
 	(void) signal(SIGQUIT, terminate);
 	(void) signal(SIGTERM, terminate);
+	(void) signal(SIGSEGV, terminate);
+	(void) signal(SIGPIPE, terminate);
+	(void) signal(SIGXCPU, terminate);
+	(void) signal(SIGXFSZ, terminate);
 	(void) signal(SIGALRM, terminate);
 	alarm(time_to_run);
 	while ((pid = wait(&status)) != -1 && pid != child_pid)
 	     /* void */ ;
 	return (pid == child_pid ? status : -1);
     }
 }

--- End Message ---
--- Begin Message ---
Version: 1.19-1

Some (long) time ago you filed this bug against the timeout package.
In the meantime the package has been removed and a timeout command is 
included in the coreutils package.

If the issue you encountered is also applicable to timeout from 
coreutils (as released with Debian 7.0 wheezy or later) the maintainers 
would very much appreciate a fresh report using

    reportbug /usr/bin/timeout

(you should also mention the number of this bug if you think it contains 
valuable information).

Please note that further information sent to this bug is likely to 
remain unread, because the bug is currently not assigned to any existing 
package.


Thank you for taking time to report bugs found in Debian packages.

Kind regards,
Andrei (with no relation to timeout, tct or coreutils maintenance)

--- End Message ---

Reply via email to