-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cksum: Update error and flags handling to improver GNU's match #7192
Conversation
GNU testsuite comparison:
|
8b92671
to
3120b16
Compare
Force pushed style fixes (diff) |
src/uu/cksum/src/cksum.rs
Outdated
|
||
let verbose = { | ||
use ChecksumVerbose::*; | ||
match (status, quiet, warn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great and fun :)
src/uu/hashsum/src/hashsum.rs
Outdated
|
||
let verbose = { | ||
use ChecksumVerbose::*; | ||
match (status, quiet, warn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe create a function for this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed ! Done 👍
GNU testsuite comparison:
|
3120b16
to
ac72268
Compare
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:
|
@sylvestre ready for review when you have some time 👍 |
thanks :) |
And that's 100% passed GNU tests for |
@RenjiSann well done :) |
This PR does 4 things:
process_checksum_line
loop 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
,--quiet
and--warn
flags 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-missing
was passed.In addition to this, I have ported the gnu test
cksum/cksum-c.sh
directly in the rust testsuite