Skip to content

shred: minor improvements and tests #7925

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

Merged
merged 2 commits into from
May 21, 2025

Conversation

alexs-sh
Copy link
Contributor

About

This is a minor improvement following the merge of #7915. It includes:

  • Defining the OPTIMAL_IO_BLOCK_SIZE constant using bitwise operations, similar to the BLOCK_SIZE constant
  • One additional test

Thank you

Copy link

GNU testsuite comparison:

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

@cakebaker
Copy link
Contributor

I'm not sure about the test. Wouldn't it make more sense to assert the condition at compile-time? Something like:

const _: () = assert!(OPTIMAL_IO_BLOCK_SIZE <= BLOCK_SIZE);

@alexs-sh
Copy link
Contributor Author

Sounds good. I'll try. Thx

alexs-sh added 2 commits May 21, 2025 14:54
The value of the variable remains unchanged (4096 = 2 ^ 12), but using a
bitwise expression provides two benefits:

- follows the same approach used for configuring BLOCK_SIZE

- indicates that a power-of-two value is preferred for this kind of
  constant
This commit adds checks for block size constants. Misconfigured sizes
could lead to overflows or performance issues. While such cases are
expected to be rare or unlikely, it's better to be notified of them
early.
@alexs-sh alexs-sh force-pushed the shred-minor-updates branch from de863a7 to 14a8f3f Compare May 21, 2025 13:55
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@cakebaker cakebaker merged commit 10b2a24 into uutils:main May 21, 2025
73 checks passed
@cakebaker
Copy link
Contributor

Thanks!

@alexs-sh
Copy link
Contributor Author

Thanks to you

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