From bee58d8a0400b0303c6dce3873fdf3482de0c110 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 27 Jul 2008 15:14:37 +0200 Subject: 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. --- tests/misc/shuf | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/misc/shuf') 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 -- cgit v1.2.3-54-g00ecf