coreutils
coreutils copied to clipboard
shuf: Refuse repeating zero lines
This was a GNU behavior bug:
$ LC_ALL=C shuf -er
shuf: no lines to repeat
[$? = 1]
$ cargo run shuf -er # old, bad (unexpected success)
$ cargo run shuf -er # new
shuf: no lines to repeat
[$? = 1]
Note that this bug already existed before #5980 and my other shuf-related PRs.
This should also fix the last testcase of the GNU shuf test.
GNU testsuite comparison:
Congrats! The gnu test tests/shuf/shuf is no longer failing!
Excellent Could you please add a test on our side? We don't rely on gnu's (too long) Thanks
Sure thing!
EDIT: Fun fact, that revealed a bug I accidentally introduced recently. :D
Changes since last push:
- Added tests. Thanks @sylvestre!
- Note that I did NOT fix or test the other newly-discovered bug, since that's a whole new can of worms, see upcoming PR.
GNU testsuite comparison:
Congrats! The gnu test tests/shuf/shuf is no longer failing!
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Changes since last push:
- Changed
test_shuf_repeat_empty_range
to test really only the empty range. Thanks @cakebaker! - Set it to
#[ignore]
, as this test necessarily triggers the bug that will be resolved in #6014 - The newly-found existing "GNU behavior bug" about negative ranges will also be handled in #6014.
Btw, I don't really understand what inotify-dir-recreate
is about, but it seems unrelated for several reasons.
GNU testsuite comparison:
Congrats! The gnu test tests/shuf/shuf is no longer failing!
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/shuf/shuf is no longer failing!
Great, thanks!