Skip to content

checksum: handle stdin before directory checks#13394

Merged
sylvestre merged 2 commits into
uutils:mainfrom
wtcpython:sha256sum-dash-stdin
Jul 18, 2026
Merged

checksum: handle stdin before directory checks#13394
sylvestre merged 2 commits into
uutils:mainfrom
wtcpython:sha256sum-dash-stdin

Conversation

@wtcpython

Copy link
Copy Markdown
Contributor

Fixes #13390.

Checksum computation checked whether each operand was a directory before handling - as standard input. As a result, a literal ./- directory caused implicit or explicit stdin input to fail.

Handle - before filesystem checks so it remains stdin regardless of entries in the working directory. Extend the existing sha256sum stdin test with a - directory regression fixture.

@HackingRepo

Copy link
Copy Markdown
Contributor

@wtcpython that is already fixed, uutils 0.8.0 is old the issue already fixed

relunsec@relunsec:~/software/coreutils/target/debug$ ./printf x | ./sha256sum
2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881  -
relunsec@relunsec:~/software/coreutils/target/debug$ 

please close that pr

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!

Comment on lines 42 to 45
let ts = TestScenario::new(util_name!());
// A directory named "-" must not shadow stdin.
ts.fixtures.mkdir("-");
assert_eq!(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a separate test for that.
Also, can you replicate the test on other test_*sum.rs files ? (though we should ideally unify theses somehow)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I moved the regression coverage into a separate test and added corresponding tests for b2sum, cksum, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, and sha512sum.

I left sum unchanged because it does not use uu_checksum_common::perform_checksum_computation and is not affected by this issue.

@RenjiSann

Copy link
Copy Markdown
Collaborator

@wtcpython that is already fixed, uutils 0.8.0 is old the issue already fixed

relunsec@relunsec:~/software/coreutils/target/debug$ ./printf x | ./sha256sum
2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881  -
relunsec@relunsec:~/software/coreutils/target/debug$ 

please close that pr

Strange that it's not fixed on my side 🤔

$ ./target/debug/sha256sum
sha256sum: -: Is a directory

@codspeed-hq

codspeed-hq Bot commented Jul 16, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 339 untouched benchmarks
⏩ 46 skipped benchmarks1


Comparing wtcpython:sha256sum-dash-stdin (c26a1fb) with main (31bc9be)

Open in CodSpeed

Footnotes

  1. 46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@RenjiSann
RenjiSann force-pushed the sha256sum-dash-stdin branch from 10405a5 to c26a1fb Compare July 17, 2026 09:39
@sylvestre
sylvestre merged commit b8e190b into uutils:main Jul 18, 2026
162 checks passed
@wtcpython
wtcpython deleted the sha256sum-dash-stdin branch July 18, 2026 07:07
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.

sha256sum implicit stdin opens literal ./- directory before stdin handling

4 participants