Subject: bug#9076: bug#9098: timeout should use waitpid

From: Paul Eggert <[email-masked]>
Date: Sun, 17 Jul 2011 12:54:19 -0700

On 07/17/11 02:44, Jim Meyering wrote:
> would you please add a note to NEWS and
> add a test case to exercise the bug?

Sure, done as follows:

>From fb266dea471f442ecd09813d3e009242135aa1ab Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sun, 17 Jul 2011 12:47:22 -0700
Subject: [PATCH 1/2] timeout: add regression test (Bug#9098)

* tests/misc/timeout: Check that 'timeout' is not confused when
starting off with a child.
---
 tests/misc/timeout |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/tests/misc/timeout b/tests/misc/timeout
index 7506e7c..04465e1 100755
--- a/tests/misc/timeout
+++ b/tests/misc/timeout
@@ -51,4 +51,9 @@ test $? = 124 && fail=1
   exec timeout 10 true
 ) || fail=1
 
+# Don't be confused when starting off with a child (Bug#9098).
+out=$(sleep 1 & exec timeout 2 sh -c 'sleep 3; echo foo')
+status=$?
+test "$out" = "" && test $status = 124 || fail=1
+
 Exit $fail
-- 
1.7.4.4

>From 5cda9009fc68485b1bd04a845e68c103170f6be8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sun, 17 Jul 2011 12:51:56 -0700
Subject: [PATCH 2/2] * NEWS: Mention fix for Bug#9098.

---
 NEWS |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index c382200..61e6e63 100644
--- a/NEWS
+++ b/NEWS
@@ -15,7 +15,8 @@ GNU coreutils NEWS                                    -*- outline -*-
   [bug introduced in coreutils-8.8]
 
   timeout now sends signals to commands that create their own process group.
-  [bug introduced in coreutils-7.0]
+  timeout is no longer confused when starting off with a child process.
+  [bugs introduced in coreutils-7.0]
 
 ** Changes in behavior
 
-- 
1.7.4.4