Repository navigation
Conversation
`cat -n -s file` was rewritten to `rtk read -n -s file`. rtk read has no
`-s`, so clap rejected it and the fallback executed a PATH binary named
`read`: a shell builtin stub on macOS, nothing at all on Linux. The
command the user typed never ran, and the exit code went from 0 to 127.
The guard above the rewrite already said only `-n` maps to rtk read, but
it tested `args.starts_with("-n ")`, so once `-n` came first every later
flag was waved through. It now classifies every argument through
arg_tokenizer and rewrites only when `-n` is the sole flag and a file is
named, which is what the comment claimed all along.
`read` also joins RTK_META_COMMANDS, so a parse failure there reports the
flag error instead of reaching for a `read` on PATH. That is the same
reasoning the list already records for `err`, `summary` and `/bin/test`;
`read` was simply missed. It leaves the test's PASSTHROUGH list, which
means "wraps a real tool".
Found by the transparency lab: 6 cases, all `cat -n -s` or `cat -n -b`,
reported as "filter broke a working command".
Co-Authored-By: Claude Opus 5 <[email protected]>
📊 Automated PR Analysis
SummaryFixes a bug where Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
Collaborator
|
Thanks for the contribution! Before we can review and merge this, the CLA needs to be signed. The CLAassistant bot left the link above, it only takes a minute. Once it's signed we'll pick the review up. |
This was referenced Oct 31, 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.
The bug
cat -n -s filewas rewritten tortk read -n -s file.rtk readhas no-s, so clap rejected it and the fallback executed a PATH binary namedread: a shell builtin stub on macOS, nothing at all on Linux. The command the user typed never ran.Cause
The guard above the rewrite already said only
-nmaps tortk read, but it tested the first argument only:Once
-ncame first, every later flag was waved through.cat -sandcat -bwere correctly skipped;cat -n -sandcat -n -bwere not.Fix
Classify every argument through
arg_tokenizerand rewrite only when-nis the sole flag and a file is named, which is what the comment claimed all along. Per coding rule 6, a string scan forstarts_with('-')is how this slipped in.readalso joinsRTK_META_COMMANDS, so a parse failure reports the flag error instead of reaching for areadon PATH. Same reasoning the list already records forerr,summaryand/bin/test;readwas simply missed. It leaves the test'sPASSTHROUGHlist, which means "wraps a real tool".Verification
cat -n -s fcat -n -b fcat -n frtk read -n frtk read --boguscargo fmt,cargo clippy --all-targetsclean, 4467 tests pass.One pre-existing failure on my machine,
a_wrapped_tools_own_help_survives_rtk, is unrelated:npm --helpexits 134 (SIGABRT) here, and cleandevelopfails that test identically with the same numbers.Provenance
Found by the transparency lab run on 0.49.0: 6 cases, all
cat -n -sorcat -n -b, reported as "filter broke a working command" (family C).🤖 Generated with Claude Code