Skip to content
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: Treat empty file as zero elements instead of one emptystring #5979

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

BenWiederhake
Copy link
Collaborator

This PR makes shuf behave more like GNU shuf in the case of empty files (e.g. null stdin).

Old behavior:

$ true | cargo run -- shuf | hd
00000000  0a                                                |.|
00000001
$

GNU behavior:

$ true | shuf | hd
$

New behavior:

$ true | cargo run -- shuf | hd
$

Note that this also makes shuf-reservoir.sh in the GNU shuf tests happy.

I'm mostly new to uutils, so please do point out any resources that might help me. (I've already read {DEVELOPMENT,CONTRIBUTING,CODE_OF_CONDUCT}.md.)

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/shuf/shuf-reservoir is no longer failing!

@cakebaker cakebaker merged commit bfe6f0f into uutils:main Feb 16, 2024
58 of 62 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR and congrats for making shuf-reservoir.sh pass :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants