Skip to content

cksum: rework blake length validation , add tests#11437

Merged
cakebaker merged 5 commits intouutils:mainfrom
RenjiSann:cksum-improve-blake-validation
Mar 25, 2026
Merged

cksum: rework blake length validation , add tests#11437
cakebaker merged 5 commits intouutils:mainfrom
RenjiSann:cksum-improve-blake-validation

Conversation

@RenjiSann
Copy link
Copy Markdown
Collaborator

This PR fixes a tricky edge case that happened when validating a length for the Blake2b algorithm in check mode, which didn't check early for the maximum allowed value, and ended up showing an unexpected error message.

To do so, I centralized all the Blake length validation logic under validate_calculate_blake_length. This function may be given a string or an int to work on, depending whether we're validating from CLI argument or check-file.

Note that it is important to preserve the string format in CLI argument, because for GNU compat, in case of error, we print the given argument, not the number we parsed from it (so that includes leading zeroes).

This MR additionnally adds more tests for BLAKE3 and some edge case tests for BLAKE2b.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 21, 2026

Merging this PR will not alter performance

✅ 300 untouched benchmarks
⏩ 46 skipped benchmarks1


Comparing RenjiSann:cksum-improve-blake-validation (c85b3b4) with main (572f3a2)

Open in CodSpeed

Footnotes

  1. 46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@RenjiSann RenjiSann force-pushed the cksum-improve-blake-validation branch 5 times, most recently from 6f514f8 to b0547e7 Compare March 21, 2026 12:39
@RenjiSann RenjiSann marked this pull request as ready for review March 21, 2026 12:43
@cakebaker
Copy link
Copy Markdown
Contributor

I don't know if you have seen it: clippy complains about two minor issues.

@RenjiSann RenjiSann force-pushed the cksum-improve-blake-validation branch from 6f2a9eb to a6f6cf7 Compare March 23, 2026 10:20
@RenjiSann
Copy link
Copy Markdown
Collaborator Author

I don't know if you have seen it: clippy complains about two minor issues.

Yes, I just fixed it ^^

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/tail/pipe-f2 is no longer failing!
Congrats! The gnu test tests/tail/tail-n0f is now passing!

@RenjiSann RenjiSann force-pushed the cksum-improve-blake-validation branch from a6f6cf7 to 98f6c4f Compare March 25, 2026 13:24
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/tail/tail-n0f. tests/tail/tail-n0f is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/date/resolution (passes in this run but fails in the 'main' branch)

@RenjiSann RenjiSann force-pushed the cksum-improve-blake-validation branch from 98f6c4f to c85b3b4 Compare March 25, 2026 15:16
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tail/symlink (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)

@cakebaker cakebaker merged commit ac72aa8 into uutils:main Mar 25, 2026
178 of 219 checks passed
@cakebaker
Copy link
Copy Markdown
Contributor

Thanks!

@RenjiSann RenjiSann deleted the cksum-improve-blake-validation branch March 25, 2026 16:04
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