checksum: handle stdin before directory checks#13394
Conversation
|
@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 |
|
GNU testsuite comparison: |
| let ts = TestScenario::new(util_name!()); | ||
| // A directory named "-" must not shadow stdin. | ||
| ts.fixtures.mkdir("-"); | ||
| assert_eq!( |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
Strange that it's not fixed on my side 🤔 $ ./target/debug/sha256sum
sha256sum: -: Is a directory |
Merging this PR will not alter performance
Comparing Footnotes
|
10405a5 to
c26a1fb
Compare
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 existingsha256sumstdin test with a-directory regression fixture.