diff options
author | Jim Meyering <meyering@redhat.com> | 2008-07-27 15:14:37 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-07-27 15:25:27 +0200 |
commit | bee58d8a0400b0303c6dce3873fdf3482de0c110 (patch) | |
tree | dbef2d9ac7afe3398a2d2ca070bc891c368a82a4 /tests | |
parent | e535754fdbe701e70f3ac9834b643a9272dc1d98 (diff) | |
download | coreutils-bee58d8a0400b0303c6dce3873fdf3482de0c110.tar.xz |
shuf: honor --zero-terminated option even with --input-range=LO-HI
* src/shuf.c (write_permuted_output): Add EOLBYTE parameter and use
it rather than hard-coding "\n".
(main): Adjust sole caller.
* tests/misc/shuf: Add a test to exercise this bug fix.
* NEWS: Mention it.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/shuf | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/misc/shuf b/tests/misc/shuf index 97109498f..83530c207 100755 --- a/tests/misc/shuf +++ b/tests/misc/shuf @@ -51,4 +51,9 @@ test "$t" = 'a b c d e' || { fail=1; echo "not a permutation" 1>&2; } # "seq 1860" produces 8193 (8K + 1) bytes of output. seq 1860 | shuf > /dev/null || fail=1 +# coreutils-6.12 and earlier would output a newline terminator, not \0. +shuf --zero-terminated -i 1-1 > out || fail=1 +printf '1\0' > exp || framework_failure +cmp out exp || { fail=1; echo "missing NUL terminator?" 1>&2; } + (exit $fail); exit $fail |