-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
cksum/hashsum: Merge common logic under a common crate #10142
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
base: main
Are you sure you want to change the base?
cksum/hashsum: Merge common logic under a common crate #10142
Conversation
28e41e6 to
ca32bc7
Compare
|
Can we split this PR much more e.g. |
Some of the current diff is actually part of #10141, |
b0e3843 to
b640d07
Compare
|
GNU testsuite comparison: |
b640d07 to
9562744
Compare
|
GNU testsuite comparison: |
9562744 to
8824943
Compare
|
GNU testsuite comparison: |
c449994 to
e2a9486
Compare
|
GNU testsuite comparison: |
e2a9486 to
a642bd6
Compare
|
GNU testsuite comparison: |
a642bd6 to
959640e
Compare
|
GNU testsuite comparison: |
|
When I measured binary size, I have Also I don't see any reason to avoid having with |
|
https://github.com/uutils/coreutils/actions/runs/20868639121/job/59976371446?pr=10142#step:13:1125 still assuming |
tests/by-util/test_sha512sum.rs
Outdated
| new_ucmd!() | ||
| .arg("--tag") | ||
| .arg("--text") | ||
| .arg("--md5") |
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.
--md5 should not be existing at anywhere.
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.
Good catch, thanks
|
#10141 was merged, but diff is still big... |
why ? what is the impact on build time ? |
|
main: main: |
959640e to
fc4ea59
Compare
|
please remove https://github.com/uutils/coreutils/actions/runs/20888696488/job/60016203582?pr=10142#step:13:1125 too. About build time, I don't mind. If distributor care about it, they should build multicall-binary (thought it affests to our CI...). |
This MR introduces a new crate
uu_checksum_common, which declareIt lies on top of #10141
Architecture explanation
Starting from now, each binary has its own crate in
src/uu:cksum, but also standalone tools likemd5sum,b2sum, etc...All of them depend on
uu_checksum_common, which lives undersrc/uu/checksum_common, which itself depends onuucore::checksum.As for who does what:
cksumhandles--untagged, which doesn't exist for standalonesb2sumhandles--lengthwheremd5sumdoesn't allow ituu_checksum_common::checksum_mainchecksum_mainhandles the common argument processing (verbose flags,--zero, etc), and callsuucore::checksum::validationoruucore::checksum::computeaccordingly.Note that all common cli error messages live under
uu_checksum_common, so a bit of piping was needed in the locale setup.Reason behind this architecture
The main goal is really to avoid code duplication as much as possible.
The symlink approach which was looked into several times, didn't feel robust enough to account for CLI differences.
Since most of the flags and the clap code was very similar, I wanted to move it in
uucore::checksum::cliat first.However, I felt like having CLI handling living under
uucorewas not a very good idea, since it would mix it with logic, and I wanteduucoreto stay free fromclap.So I took the same approach as what's happening in
base32|64|nc, where all the common code is defined in base32 which is then re-imported in base64 and basenc, only here I created a dedicated crate.