-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shuf: include all echo args, not just the last #5978
Conversation
CI failed, and I see a similar ICE panic when I run pre-commit (specifically Anyway, stable clippy ( EDIT: Also, I cannot reproduce the CI test failures of |
You can ignore both failures, they're known issues :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I just think there's one case that's not handled correctly by this.
639702e
to
b091911
Compare
Changes since last push:
|
GNU testsuite comparison:
|
Good job, thanks! |
This PR fixes all
shuf
bugs around repeated arguments:--echo
. uutilsshuf
currently only considers the very last--echo
, and ignores all the others.-n
), effectively only considering the lowest. uutilsshuf
currently only considers the very last--head-count
, and ignores all the others.shuf
currently only considers the very last element each, silently ignoring all the others.This is clearly buggy, since command-line arguments should be ignored only in exceptional cases. This appears to be a regression after #3329.
In this PR I'm fixing these and adopt the behavior of GNU, which is in my eyes the only sane reaction to those scenarios. Of course, this PR also adds tests for that.
I'm entirely new to uutils, so please do point out any resources that might help me. (I've already read {DEVELOPMENT,CONTRIBUTING,CODE_OF_CONDUCT}.md.)
Multiple echos example
The following demonstrations are run with this diff applied, to see what's going on:
Behavior before this PR:
Note that
shuf
isn't even aware thata
andb
were passed in.Behavior after this PR: