Skip to content

Try to fix *sum on windows#10761

Open
RenjiSann wants to merge 1 commit intouutils:mainfrom
RenjiSann:fix-cksum-windows
Open

Try to fix *sum on windows#10761
RenjiSann wants to merge 1 commit intouutils:mainfrom
RenjiSann:fix-cksum-windows

Conversation

@RenjiSann
Copy link
Collaborator

Attempt to fix #6655

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/basenc/bounded-memory is now passing!

@RenjiSann
Copy link
Collaborator Author

@YDX-2147483647 @wu0lss4j Could you test with this branch if that fixes your problem ?

@YDX-2147483647
Copy link
Contributor

YDX-2147483647 commented Feb 6, 2026

Thank you for working on it!

Here're the results for a.fake-ttf + this PR on my machine.

❯ 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: OK

This PR fixes the problem of sha256sum --check, but also introduces unwanted changes.
Compare this PR with 0.5.0:

❯ 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 okay

Edit: 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

@RenjiSann
Copy link
Collaborator Author

This PR is not the reason for this unwanted behavior, sicne I only changed a piece of code that is run in --check mode only. I'll investigate

@RenjiSann
Copy link
Collaborator Author

Actually, that reopens the debate of --text and --binary handling #9168.

The "unwanted" behavior for cksum -a sha256 a.ttf is the one actually expected if we follow the GNU documentation

 ‘--binary’
...
This option is the default on systems like
MS-DOS that distinguish between binary and text files

At the time, we decided to ignore --binary as it didn't change the behavior on UNIX and GNU didn't work on Windows, but now I realize that we should still be coherent at least for the --check option.

@RenjiSann RenjiSann marked this pull request as ready for review February 6, 2026 18:05
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

GNU testsuite comparison:

GNU test failed: tests/env/env-signal-handler. tests/env/env-signal-handler is passing on 'main'. Maybe you have to rebase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FAILED checksums using sha256sum in windows 11

2 participants