Try to fix *sum on windows - #10761
Conversation
|
GNU testsuite comparison: |
|
@YDX-2147483647 @wu0lss4j Could you test with this branch if that fixes your problem ? |
|
Thank you for working on it! Here're the results for ❯ cargo r -r -- sha256sum a.fake-ttf
1c671d7322d49cd2726475f4b8a8b50f27b454789e23a31c6ac14014740d8e58 a.fake-ttf
❯ cargo r -r -- sha256sum --text a.fake-ttf
1c671d7322d49cd2726475f4b8a8b50f27b454789e23a31c6ac14014740d8e58 a.fake-ttf
❯ cargo r -r -- sha256sum --binary a.fake-ttf
1c671d7322d49cd2726475f4b8a8b50f27b454789e23a31c6ac14014740d8e58 *a.fake-ttf
❯ cargo r -r -- sha256sum --text a.fake-ttf | cargo r -r -- sha256sum --check
a.fake-ttf: OK
❯ cargo r -r -- sha256sum --binary a.fake-ttf | cargo r -r -- sha256sum --check
a.fake-ttf: OKThis PR fixes the problem of ❯ coreutils --version
coreutils 0.5.0 (multi-call binary)
❯ coreutils sha256sum a.fake-ttf
1c671d7322d49cd2726475f4b8a8b50f27b454789e23a31c6ac14014740d8e58 *a.fake-ttf # 👈 I don't think `*` should be removed
❯ coreutils sha256sum --text a.fake-ttf
73c0a22f7ed1c54ebde921712ced33d9458975cd86e9fe4757257fdd6293e512 a.fake-ttf # 👈 I think this is the correct output, and should not be changed.
❯ coreutils sha256sum --binary a.fake-ttf
1c671d7322d49cd2726475f4b8a8b50f27b454789e23a31c6ac14014740d8e58 *a.fake-ttf # Unchanged and okayEdit: Should the following fail? ❯ coreutils sha256sum --text a.fake-ttf | cargo r -r sha256sum --check
a.fake-ttf: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match |
|
This PR is not the reason for this unwanted behavior, sicne I only changed a piece of code that is run in |
|
Actually, that reopens the debate of The "unwanted" behavior for At the time, we decided to ignore |
6f0a2f7 to
f5fc1a5
Compare
|
GNU testsuite comparison: |
Hi, sorry for the delay, every test yields FAILED, sorry. |
|
@wu0lss4j v0.6.0 does not include changes made in this pull request. To test this pull request, you have to clone this branch and compile it with a rust toolchain. Here's the |
no worries, I trust your build and outcome. Meanwhile I got all my checksum needs serviced by the sha256sum binary that is bundled with the git package |
c1c7bfa to
e2beb21
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
Merging this PR will not alter performance
Comparing Footnotes
|
please replace your screenshots by text, they are not great for accessibility and search |
|
and would be nice to have a test |
OK, if and when there is a new release, I will test it and paste here the results in text form. However, it's quite easy to reproduce coreutils wintel binaries 0.6.0, run checksum, then run verification, I don't fully understand the math behind all the calculations, so I can't tell if the the issue is a faulty "recalculation" or just the easy peasy diff against the file that contains the list of checksum for the --check op |
|
Hey all, Nevertheless, I hope I can help troubleshooting this issue, as I'm having the same problem. tl;dr: Seems to be fine now with the patched coreutils.exe! My setup: Current Windows 11, cmd, scoop with uutils-coreutils 0.5.0/0.6.0 (and several other packages). I did some other testing with different line endings, and found "\r\n" to be problematic. But my main problem, which led me here, with coreutils 0.5.0, is this: > sha256sum *.tar.gz > sha
> sha256sum -b *.tar.gz > sha-b
> sha256sum -t *.tar.gz > sha-t
> cat sha
733876246e1bb6171a2b849b5df8ce0f702139eb1c5842b2a610acce44651abf *2026-02-15_backup.tar.gz
> cat sha-b
733876246e1bb6171a2b849b5df8ce0f702139eb1c5842b2a610acce44651abf *2026-02-15_backup.tar.gz
> cat sha-t
717bbf87ab8d3de2b4b26fdc57cceb9b409832c30033c6497e7070b386b8d4fd 2026-02-15_backup.tar.gz
> sha256sum -c sha-b
2026-02-15_backup.tar.gz: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
> sha256sum -c sha-t
2026-02-15_backup.tar.gz: OK
Now the same with 0.6.0: > cat sha
733876246e1bb6171a2b849b5df8ce0f702139eb1c5842b2a610acce44651abf 2026-02-15_backup.tar.gz
> cat sha-b
733876246e1bb6171a2b849b5df8ce0f702139eb1c5842b2a610acce44651abf *2026-02-15_backup.tar.gz
> cat sha-t
733876246e1bb6171a2b849b5df8ce0f702139eb1c5842b2a610acce44651abf 2026-02-15_backup.tar.gz
> sha256sum -c sha-b
2026-02-15_backup.tar.gz: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
> sha256sum -c sha-t
2026-02-15_backup.tar.gz: FAILED
sha256sum: WARNING: 1 computed checksum did NOT matchThis time, Now the same with coreutils-f5fc1a597.zip: > coreutils sha256sum -c sha
2026-02-15_backup.tar.gz: OK
> coreutils sha256sum -c sha-b
2026-02-15_backup.tar.gz: OK
> coreutils sha256sum -c sha-t
2026-02-15_backup.tar.gz: OK(The hash code generation is the same as with 0.6.0) So this seems to be fine now. Thank you so much! BTW: In WSL2 Ubuntu, all hashes generated by 0.6.0 from windows seem to match correctly. So the behavior of the patched coreutils.exe seems to match Ubuntu's GNU version. BTW2: My other tests (different line endings, |
|
Just to let you know, I didn't have time to work on this in the last days, and probably won't for another few weeks, so if someone wants to carry on, please feel free to do so :) |
|
GNU testsuite comparison: |
| let reading_mode = if cfg!(not(unix)) { | ||
| ReadingMode::Binary | ||
| } else { | ||
| ReadingMode::Text | ||
| }; |
There was a problem hiding this comment.
I came across this issue today. Shouldn't this use the binary mode unconditionally, because the other side (in compute.rs) uses binary mode unconditionally as well?



Attempt to fix #6655