diff options
author | Pádraig Brady <P@draigBrady.com> | 2009-12-08 08:48:34 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2009-12-08 15:29:27 +0000 |
commit | f5a97b8269f11f63cf05cca1f31a08dc7567aeb9 (patch) | |
tree | 068974c268ee16418d1b08dc98e1db4e4f4daeab /tests | |
parent | 73d46261344d5bd05c0940bc2ec5f9ed9a47db1b (diff) | |
download | coreutils-f5a97b8269f11f63cf05cca1f31a08dc7567aeb9.tar.xz |
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 in a subshell
to SIG_IGN to ensure the sort command resets it to SIG_DFL.
* NEWS: Mention the fix.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/sort-compress | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/misc/sort-compress b/tests/misc/sort-compress index 7e4278e51..2711833b3 100755 --- a/tests/misc/sort-compress +++ b/tests/misc/sort-compress @@ -30,7 +30,6 @@ SORT="$abs_top_builddir/src/sort" # Ensure that $TMPDIR is valid. TMPDIR=.; export TMPDIR - # This should force the use of temp files sort -S 1k in > out || fail=1 compare exp out || fail=1 @@ -44,6 +43,16 @@ EOF chmod +x gzip +# Ensure `sort` is immune to parent's SIGCHLD handler +# Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh. +( + # ash doesn't support "trap '' CHLD"; it knows only signal numbers. + sig=`"$abs_top_builddir/src/kill" -l CHLD 2>/dev/null` && trap '' $sig + + # This should force the use of child processes for "compression" + PATH=.:$PATH exec sort -S 1k --compress-program=gzip in > /dev/null +) || fail=1 + # This will find our new gzip in PATH PATH=.:$PATH sort -S 1k --compress-program=gzip in > out || fail=1 compare exp out || fail=1 |