Pádraig Brady wrote: > The same issue as with the previous `timeout` patch. > The attached includes at test, but I'll probably remove > it because of the previously mentioned concerns.
really attached this time. sorry
>From 33904143eab537385ce1af58ea15c1876da402c7 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?P=C3=A1draig=20Brady?= <[email protected]> Date: Tue, 8 Dec 2009 08:48:34 +0000 Subject: [PATCH] sort: fix failure if sort's parent has ignored SIGCHLD * src/sort.c (main): Reset the SIGCHLD handler to the default as otherwise wait() could return an error. * tests/misc/sort-compress: Set the CHLD handler to SIG_IGN to ensure the sort command resets it to SIG_DFL. * NEWS: Mention the fix. --- NEWS | 4 ++++ src/sort.c | 1 + tests/misc/sort-compress | 2 ++ 3 files changed, 7 insertions(+), 0 deletions(-) diff --git a/NEWS b/NEWS index 19cca5b..528eedc 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ GNU coreutils NEWS -*- outline -*- the presence of the empty string argument. [bug introduced in coreutils-8.0] + sort is now immune to the signal handling of its parent. + Specifically sort now doesn't exit with an error message + if it uses helper processes for compression and its parent + ignores CHLD signals. [bug introduced in coreutils-6.9] * Noteworthy changes in release 8.1 (2009-11-18) [stable] diff --git a/src/sort.c b/src/sort.c index 8709e53..70e0bbb 100644 --- a/src/sort.c +++ b/src/sort.c @@ -3254,6 +3254,7 @@ main (int argc, char **argv) } #endif } + signal (SIGCHLD, SIG_DFL); /* Don't inherit CHLD handling from parent. */ /* The signal mask is known, so it is safe to invoke exit_cleanup. */ atexit (exit_cleanup); diff --git a/tests/misc/sort-compress b/tests/misc/sort-compress index 7e4278e..e923e64 100755 --- a/tests/misc/sort-compress +++ b/tests/misc/sort-compress @@ -23,6 +23,8 @@ fi . $srcdir/test-lib.sh +trap '' CHLD # ensure `sort` is immune to parent's SIGCHLD handler + seq -w 2000 > exp || framework_failure tac exp > in || framework_failure SORT="$abs_top_builddir/src/sort" -- 1.6.2.5
