diff options
author | Pádraig Brady <P@draigBrady.com> | 2023-03-23 12:31:24 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2023-03-23 12:36:53 +0000 |
commit | 76f2fb627118a26c25003dbd98c22c153b7ee1d2 (patch) | |
tree | ed7ed77e149e1acc28e4399fc88c2f38955a3000 /tests | |
parent | eeabb11eb6697a137894db066715a07550c6d82a (diff) | |
download | coreutils-76f2fb627118a26c25003dbd98c22c153b7ee1d2.tar.gz |
cksum: fix reporting of failed checks
This applies to all checksumming utilities,
where we incorrectly report all subsequent files as checking 'OK'
once any file has passed a digest check.
The exit status was not impacted, only the printed status.
* src/digest.c (digest_check): Use the correct state variable
to determine if the _current_ file has passed or not.
* tests/misc/md5sum.pl: Add a test case.
Fixes https://bugs.gnu.org/62403
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/md5sum.pl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/misc/md5sum.pl b/tests/misc/md5sum.pl index 186aca977..d712664b2 100755 --- a/tests/misc/md5sum.pl +++ b/tests/misc/md5sum.pl @@ -101,6 +101,16 @@ my @Tests = . "md5sum: WARNING: 1 line is improperly formatted\n" . "md5sum: WARNING: 2 computed checksums did NOT match\n"}, {EXIT=> 1}], + # Ensure we use appropriate state to track failures (broken in 9.2) + ['check-multifail-state', '--check', '--warn', + {IN=>{'f.md5' => + "$degenerate f\n" + . "$degenerate g\n" + . "$degenerate f\n" }}, + {AUX=> {f=> ''}}, {AUX=> {g=> 'a'}}, + {OUT=>"f: OK\ng: FAILED\nf: OK\n"}, + {ERR=>"md5sum: WARNING: 1 computed checksum did NOT match\n"}, + {EXIT=> 1}], # The sha1sum and md5sum drivers share a lot of code. # Ensure that md5sum does *not* share the part that makes # sha1sum accept BSD format. |