-
-
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: failing GNU tests #2930
Comments
So |
Investigating the codebase a bit further, I see that both |
Looks like I'm going to try implementing this. |
I made a bunch of progress on this and then ran out of time to finish the PRs. Picking this back up now; I'll rebase my current local work and get some initial PRs up. |
Several binaries have been added to `hashsum` that have never been part of GNU Coreutils: - `sha3*sum` (uutils#869) - `shake*sum` (uutils#987) - `b3sum` (uutils#3108 and uutils#3164) In particular, the `--bits` option, and the `--no-names` option added in uutils#3361, are not valid for any GNU Coreutils `*sum` binary (as of Coreutils 9.0). This commit refactors the argument parsing so that `--bits` and `--no-names` become invalid options for the binaries intended to match the GNU Coreutils API, instead of being ignored options. It also refactors the custom binary name handling to distinguish between binaries intended to match the GNU Coreutils API, and binaries that don't have that constraint. Part of uutils#2930.
Several binaries have been added to `hashsum` that have never been part of GNU Coreutils: - `sha3*sum` (uutils#869) - `shake*sum` (uutils#987) - `b3sum` (uutils#3108 and uutils#3164) In particular, the `--bits` option, and the `--no-names` option added in uutils#3361, are not valid for any GNU Coreutils `*sum` binary (as of Coreutils 9.0). This commit refactors the argument parsing so that `--bits` and `--no-names` become invalid options for the binaries intended to match the GNU Coreutils API, instead of being ignored options. It also refactors the custom binary name handling to distinguish between binaries intended to match the GNU Coreutils API, and binaries that don't have that constraint. Part of uutils#2930.
Ugh, this is annoying: There are three options here:
We have a somewhat-similar issue in that |
cc @oconnor663 who wrote |
While I really want GNU's compatibility, we workaround with upstream testsuite from time to time. See |
Note that the suprising behaviour you mentioned in option 2 not only happens between b3sum implementations but also between different hashing algorithms. I.e. if I use the external b3sum first and then (GNU) b2sum, then the length does not match either. Hence, I think we bring back the consistency and should build what a hypothetical GNU b3sum would look like, not what another b3sum already does, to ensure compatibility/consistency with GNU and with the other utils in uutils. I like the first option too, but it would indeed break GNU compatibility, so like Sylvestre mentioned, we'd have to work around the tests. Not to mention that it could be surprising for GNU users (although we'd err on the secure side). |
Several binaries have been added to `hashsum` that have never been part of GNU Coreutils: - `sha3*sum` (uutils#869) - `shake*sum` (uutils#987) - `b3sum` (uutils#3108 and uutils#3164) In particular, the `--bits` option, and the `--no-names` option added in uutils#3361, are not valid for any GNU Coreutils `*sum` binary (as of Coreutils 9.0). This commit refactors the argument parsing so that `--bits` and `--no-names` become invalid options for the binaries intended to match the GNU Coreutils API, instead of being ignored options. It also refactors the custom binary name handling to distinguish between binaries intended to match the GNU Coreutils API, and binaries that don't have that constraint. Part of uutils#2930.
Yeah, the inconsistency blows. Here are some scattered thoughts about why it ended up the way it is:
Which is all to say, that when there's a choice between counting bits and counting bytes, BLAKE3 pretty strongly prefers to count bytes. It keeps CLIs and library APIs consistent with each other, and it avoids some common points of confusion. But sometimes there isn't a choice, like our situation here, and then we suffer some inconsistency. |
Interesting! That does make it clearer as to why b3sum is different. Maybe a solution could be to make a split API. So b2sum (and the other ones GNU supports) would accept a |
If you all decide to do something like |
Several binaries have been added to `hashsum` that have never been part of GNU Coreutils: - `sha3*sum` (uutils#869) - `shake*sum` (uutils#987) - `b3sum` (uutils#3108 and uutils#3164) In particular, the `--bits` option, and the `--no-names` option added in uutils#3361, are not valid for any GNU Coreutils `*sum` binary (as of Coreutils 9.0). This commit refactors the argument parsing so that `--bits` and `--no-names` become invalid options for the binaries intended to match the GNU Coreutils API, instead of being ignored options. It also refactors the custom binary name handling to distinguish between binaries intended to match the GNU Coreutils API, and binaries that don't have that constraint. Part of uutils#2930.
Current $ type B3SUMS
79b4c2c09d6f3ac0beee530cb69262f81ce303144620728e8c98044dd543ceb2 *out1.png
7febfd4fd14642e0f70c50dd096ec684f6d05afce5d606aeb157ec93a96890ed *out2.png
17a7f68466e2b437042a5b2ebad2b3abde27f2b83d0c57358a2cbfbb31cf05ed *out3.png
$ b3sum -c B3SUMS
b3sum: Invalid space
b3sum: WARNING: 3 computed checksums did NOT match We need to either discuss it or bring this part of P.S. I already have a dozen BLAKE3 implementations, mostly downloaded from Github, and the output format is different between them. The original one also refuses to hash lists with CRLF line breaks, typical for Windows (such lists are generated, for example, by RapidCRC). Obviously, this UX mess creates a difficulty for replacing SHA256.
Click to broaden your horizons even further (and to see a SFW picture!)…When, among partners, concord there is not. A crayfish, swan and pike combining. — Ivan Krylov, “Crayfish, Swan and Pike” (1814), |
It would appear this was fixed via #6499. |
The latest version of GNU's tests add
tests/misc/cksum
,tests/misc/cksum-a
,tests/misc/cksum-c
, andtests/misc/sm3sum
, all of which currently fail. This will track the respective problems from each.The text was updated successfully, but these errors were encountered: