Repository navigation
Conversation
…ouched Mask command substitutions before applying the existing top-level rewrite pipeline. Restore their original bytes without regexes or new dependencies. Refs rtk-ai#1109 rtk-ai#3558 rtk-ai#1282
Collaborator
|
Closing: already fixed on develop. Since #2286 (v0.42.3) the hook defers any command containing an unquoted |
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.
Problem
The hook rewrites commands that appear inside
$(...)or backtick substitutions. For example:becomes
"$(rtk jq -cn ...)". The inner command's output is data consumed by the outer command, so the compacted output plus the tee pointer corrupt it. Same root cause as #1109 (gitinside$(...)).Fix
Before the existing top-level rewrite, a single pass masks complete
$(...)and paired backtick substitutions (nesting, escapes, quotes and comments respected; single-quoted text stays literal). The top-level decision runs on the masked command, then the original slices are restored byte-for-byte. No regex, no new dependency, no change to heredoc, pipeline or xargs handling.Tests
8 unit tests in
registry.rs: outer rewrite with inner$(...)kept, unsupported outer command returns None, backtick variant, single-quoted literal, nested substitutions, operators and)inside a substitution comment.cargo test,cargo clippy --all-targets -- -D warnings,cargo fmt --checkall pass.Fixes #1109. Refs #3558, #1282. Supersedes the subshell part of #2693, which has conflicts.