fix(hashsum): always report malformed input with --status (fixes #12867)#12973
Open
koopatroopa787 wants to merge 1 commit into
Open
fix(hashsum): always report malformed input with --status (fixes #12867)#12973koopatroopa787 wants to merge 1 commit into
koopatroopa787 wants to merge 1 commit into
Conversation
…ls#12867) Previously, when all checksum lines were improperly formatted, the "no properly formatted checksum lines found" error was silently suppressed when --status was active. RFC-4634 and GNU coreutils both emit this diagnostic regardless of --status; only per-file OK/FAILED lines are suppressed. Remove the `over_status()` guard around `log_no_properly_formatted` so the error is always printed. Add a regression test for md5sum. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
GNU testsuite comparison: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #12867.
When
md5sum -c --status(or any hashsum variant) receives input where all checksum lines are improperly formatted, it previously exited with an error code but printed no diagnostic at all. GNU coreutils emits"md5sum: 'stdin': no properly formatted checksum lines found"in this case regardless of--status.The
--statusflag is documented to suppress per-fileOK/FAILEDlines, not structural error messages about the input format itself.Change
In
src/uucore/src/lib/features/checksum/validate.rs, removed theopts.verbose.over_status()guard aroundlog_no_properly_formatted():This fix applies to all hashsum utilities (md5sum, sha256sum, sha512sum, b2sum, etc.) since they share this code path.
Tests
Added
test_check_status_reports_malformed_inputintests/by-util/test_md5sum.rsthat asserts the error message appears on stderr even with--status.Note: PR #12622 made the same fix but only added a b2sum test; this PR adds coverage for md5sum and fixes the root cause in the shared validation code.