cksum: Update error and flags handling to improver GNU's match#7192
Merged
sylvestre merged 5 commits intouutils:mainfrom Jan 23, 2025
Merged
cksum: Update error and flags handling to improver GNU's match#7192sylvestre merged 5 commits intouutils:mainfrom
sylvestre merged 5 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
8b92671 to
3120b16
Compare
Collaborator
Author
|
Force pushed style fixes (diff) |
sylvestre
reviewed
Jan 22, 2025
src/uu/cksum/src/cksum.rs
Outdated
|
|
||
| let verbose = { | ||
| use ChecksumVerbose::*; | ||
| match (status, quiet, warn) { |
Contributor
There was a problem hiding this comment.
this is great and fun :)
sylvestre
reviewed
Jan 22, 2025
src/uu/hashsum/src/hashsum.rs
Outdated
|
|
||
| let verbose = { | ||
| use ChecksumVerbose::*; | ||
| match (status, quiet, warn) { |
Contributor
There was a problem hiding this comment.
maybe create a function for this ?
|
GNU testsuite comparison: |
3120b16 to
ac72268
Compare
Collaborator
Author
|
Move |
|
GNU testsuite comparison: |
ac72268 to
1900339
Compare
|
GNU testsuite comparison: |
…n` override each other
…x logic for --ignore-missing
1900339 to
84bbd05
Compare
|
GNU testsuite comparison: |
Collaborator
Author
|
@sylvestre ready for review when you have some time 👍 |
Contributor
|
thanks :) |
Collaborator
Author
|
And that's 100% passed GNU tests for |
Contributor
|
@RenjiSann well done :) |
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.
This PR does 4 things:
process_checksum_lineloop instead of only printing in the case of a problem of algorithm parsing (necessary for passing tests for--warn)Example:
Change the way the
--status,--quietand--warnflags interact together. In GNU, these flags supersedes each other to set a specific verbose level, while our implementation was just setting flags. Now, our implementation is using a verbose logic as well (STATUS, QUIET, NORMAL, WARN), and the last flag passed on CLi will override the others.Fix a bug which prevented cksum to return with an error exit code upon a failing checksum in case
--ignore-missingwas passed.In addition to this, I have ported the gnu test
cksum/cksum-c.shdirectly in the rust testsuite