mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
tests: avoid a race in timeout-group.sh
* tests/misc/timeout-group.sh: The kernel might possibly delay signal propagation to timeout.cmd long enough, that it exits normally without running the signal handler (as sleep will be in the same process group and so get the signal too). So avoid this by explicitly checking that the signal handler is called, which should always happen under normal circumstances. Reported by Stefano Lattarini on linux-2.6.30-2-686 and bash-4.2.36.
This commit is contained in:
1 parent
82b1728c4b
commit
751a4c4d03
1 file changed
+5
-1
@@ -34,7 +34,11 @@ cat > timeout.cmd <<\EOF
|
||||
#!/bin/sh
|
||||
trap 'touch int.received; exit' INT
|
||||
touch timeout.running
|
||||
sleep $1
|
||||
count=$1
|
||||
until test -e int.received || test $count = 0; do
|
||||
sleep 1
|
||||
count=$(expr $count - 1)
|
||||
done
|
||||
EOF
|
||||
chmod a+x timeout.cmd
|
||||
|
||||
|
||||
Reference in new issue
Block a user