fix: shasum -c / sha256sum -c read checksum lines from stdin - #88
Merged
Conversation
Check mode treated `-` as a filesystem path and treated a missing operand as success after verifying nothing. GNU/BSD coreutils read checksum lines from stdin in both cases. Apply the same StdinOperand treatment the hashing path already had. Co-authored-by: Dave Lucia <davelucianyc@gmail.com>
davydog187
marked this pull request as ready for review
August 21, 2026 16:33
This was referenced Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #81
shasum -c/sha256sum -ctreated-as a filesystem path and treated a missing operand as success after verifying nothing. That is a silent wrong answer for agent tool-use: a caller checking a checksum got exit 0 whether or not the file matched.GNU coreutils
sha256sumand Perlshasumboth read checksum lines from stdin when the operand is-or when there is no operand. The hashing path already had thatStdinOperandtreatment (PR #74); check mode did not.User-visible behavior
A checksum file operand is unchanged:
sha256sum -c /sumsstill verifies that file. A mismatch still printsFAILEDand exits 1.JustBash.exec/2does not raise.Changes
defaults_to_stdin/1, so a missing operand is-StdinOperand.read/4, so-is stdin rather than a path-as stdin, a missing operand, a normal file operand, and a mismatch via stdin — for bothsha256sumandshasumType of Change
Testing
sha256sum9.4 and Perlshasum6.04Local gates:
Checklist
mix formatmix credoand addressed any issues