Skip to content

Conversation

@blyxxyz
Copy link
Contributor

@blyxxyz blyxxyz commented Mar 16, 2025

  • shuf now uses OS strings, so it can read from filenames that are invalid Unicode and it can shuffle arguments that are invalid Unicode. uucore now has an OsWrite trait to support this without platform-specific boilerplate.

  • shuf no longer tries to split individual command line arguments, only bulk input from a file/stdin. (This matches GNU and busybox.)

  • More values are parsed inside clap instead of manually, leading to better error messages and less code.

  • Some code has been simplified or made more idiomatic.

I plan to follow up with a PR to optimize shuf with vectored writes and mmap. (Last time I tried this I got sidetracked by a stdlib bug: rust-lang/rust#121938)

blyxxyz added 3 commits March 16, 2025 14:10
- shuf now uses OS strings, so it can read from filenames that are
  invalid Unicode and it can shuffle arguments that are invalid
  Unicode. `uucore` now has an `OsWrite` trait to support this without
  platform-specific boilerplate.

- shuf no longer tries to split individual command line arguments,
  only bulk input from a file/stdin. (This matches GNU and busybox.)

- More values are parsed inside clap instead of manually, leading to
  better error messages and less code.

- Some code has been simplified or made more idiomatic.
This removes the need for some manually duplicated code and keeps
shuf_exec() (which is generic) smaller, for less binary bloat and
better build times.
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)

@sylvestre
Copy link
Contributor

as you are working on it, maybe implement #2528 ? :)

@sylvestre sylvestre merged commit eed5c81 into uutils:main Mar 22, 2025
67 checks passed
@blyxxyz blyxxyz deleted the clean-shuf branch March 22, 2025 21:37
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