Skip to content

checksum: warn about unreadable files before mismatches in --check - #17022

Open
ChihweiLHBird wants to merge 1 commit into
uutils:mainfrom
ChihweiLHBird:checksum-check-summary-order
Open

ChihweiLHBird wants to merge 1 commit into
uutils:mainfrom
ChihweiLHBird:checksum-check-summary-order

Conversation

@ChihweiLHBird

Copy link
Copy Markdown
Contributor

Summary

When a checksum list has both a file that cannot be read and a digest that does not match, --check printed the two summary warnings in the opposite order to GNU. Print the warning about unreadable files first. This applies to cksum, md5sum, sha*sum and b2sum.

Only the order of these two lines changes. The other output and the exit status stay the same.

Example

$ printf 'a\n' > a
$ printf '%032d  a\n%032d  missing\n' 0 0 > sums
$ md5sum --check sums

sums has a wrong digest for a, and it names a file missing that does not exist.

Before:

a: FAILED
md5sum: missing: No such file or directory
missing: FAILED open or read
md5sum: WARNING: 1 computed checksum did NOT match
md5sum: WARNING: 1 listed file could not be read

After, same as GNU:

a: FAILED
md5sum: missing: No such file or directory
missing: FAILED open or read
md5sum: WARNING: 1 listed file could not be read
md5sum: WARNING: 1 computed checksum did NOT match

The exit status is 1 before and after.

Copilot AI balanced review requested due to automatic review settings November 30, 2026 11:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@sylvestre

Copy link
Copy Markdown
Contributor

ci seems broken

@ChihweiLHBird
ChihweiLHBird force-pushed the checksum-check-summary-order branch from c805d5c to f2bf7d9 Compare November 30, 2026 21:34
Copilot AI balanced review requested due to automatic review settings November 30, 2026 21:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@ChihweiLHBird

Copy link
Copy Markdown
Contributor Author

ci seems broken

I just rebased, and let's see if it's fixed now

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/tail/truncate. tests/tail/truncate is passing on 'main'. Maybe you have to rebase?

With both a file that cannot be read and a digest mismatch, --check printed the two summary warnings in the opposite order to GNU. Print the warning about unreadable files first.

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
@ChihweiLHBird
ChihweiLHBird force-pushed the checksum-check-summary-order branch from f2bf7d9 to de47f0c Compare December 1, 2026 20:29
Copilot AI balanced review requested due to automatic review settings December 1, 2026 20:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue

Review effort: Lite

Comment thread tests/by-util/test_cksum.rs Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue
1 resolved since last review

Review effort: Lite

Comment on lines +2181 to +2188
d41d8cd98f00b204e9800998ecf8427e missing\n",
)
.fails_with_code(1)
.stdout_is("f: FAILED\nmissing: FAILED open or read\n")
.stderr_is(
"cksum: missing: No such file or directory\n\
cksum: WARNING: 1 listed file could not be read\n\
cksum: WARNING: 1 computed checksum did NOT match\n",

This branch has not been deployed

No deployments
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.

3 participants