diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-01-05 19:40:03 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-01-05 19:40:21 -0800 |
commit | 63bc65fbe7ae850a03e0f343cf922767b4faf3ab (patch) | |
tree | a5bcb0ad5c383ad0b9ac94fda6ba903df3c895a0 /tests | |
parent | 7f235156bcf644c4cccc5670f0468d89c64b822d (diff) | |
download | coreutils-63bc65fbe7ae850a03e0f343cf922767b4faf3ab.tar.xz |
shuf: do not mishandle 'shuf -i0-0 1'
Problem reported by Daiki Ueno in: http://bugs.gnu.org/19520
* src/shuf.c (main): Avoid core dump if !input_range.
* tests/misc/shuf.sh: Test for this bug.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/shuf.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/misc/shuf.sh b/tests/misc/shuf.sh index 7e7710254..5e85d9aca 100755 --- a/tests/misc/shuf.sh +++ b/tests/misc/shuf.sh @@ -47,6 +47,10 @@ test "$t" = 'a b c d e' || { fail=1; echo "not a permutation" 1>&2; } shuf -er test $? -eq 1 || fail=1 +# coreutils-8.23 dumps core. +shuf -i0-0 1 +test $? -eq 1 || fail=1 + # Before coreutils-6.3, this would infloop. # "seq 1860" produces 8193 (8K + 1) bytes of output. seq 1860 | shuf > /dev/null || fail=1 |