Repository navigation
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dev1abz
added a commit
to dev1abz/rtk
that referenced
this pull request
Aug 7, 2026
4 tasks done
2 tasks done
2 tasks done
Contributor
|
This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet. |
Contributor
|
Closing this pull request after a prolonged period of inactivity. If this is still relevant, please ask for it to be reopened. Thank you! |
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.
Summary
run_fallbackinsrc/main.rscalledstd::env::args(), which aborts the process when any argument is not valid UTF-8. Clap rejects such args first and routes to the fallback, sortk grep -c $'\xc3\xa2\xe2\x80'reliably aborted with exit 134 before the wrapped command ever ran.args_os()into aVec<OsString>and passes those to the wrapped command, so the original bytes reach it unchanged; a lossyVec<String>is derived only for the display, tracking, and TOML-filter-lookup strings.restore_double_dashinsrc/core/args_utils.rshad the sameenv::args()call and got the same treatment. Nostd::env::args()calls remain insrc/.to_string_lossywould also have stopped the abort, but it would have silently replaced the bytes passed to the underlying command. The rawOsStrings are kept on the execution path deliberately; the second test below pins that behavior.Fixes #3025.
Test plan
cargo fmt --all && cargo clippy --all-targets && cargo testrtk <command>output inspectedNew
tests/non_utf8_argv_test.rs(unix-only, since Windows argv is UTF-16) adds two tests:non_utf8_arg_does_not_abort— asserts rtk doesn't panic or get killed by a signal when given a non-UTF-8 argument. This is how I reprod the reported panic initially.non_utf8_arg_reaches_the_wrapped_command_verbatim— proves the invalid bytes reach the wrapped command unchanged (would fail if the fix used a lossy conversion instead of keeping rawOsStrings).Both tests were red on
developbaseline and green after this fix.Gate results:
cargo fmt --all --checkclean,cargo clippy --all-targetsno warnings,cargo test --all2566 passed / 0 failed.rtk printf '%s' hellostill behaves normally.