Repository navigation
fix(interpreter): brace expansion before other expansions - #2579
Merged
Merged
Conversation
Brace expansion now runs on the parsed word, before parameter and command expansion, treating everything but unquoted literal text as opaque. Expansion results no longer brace-expand, quoted and escaped braces and commas stay literal, invalid groups keep later groups expanding, empty items are dropped and ranges zero-pad. The lexer treats braces as ordinary word characters. Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 3ff18b0 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 05:23 PM |
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.
Requested by Михайло · project thread
What changed
Brace expansion now runs first, on the parsed word, as in bash. Only unquoted literal text takes part; variables, substitutions and quoted segments are opaque. The lexer no longer has ad hoc readers for words starting with
{(they ignored quotes and split words).Why
Pseudo-linus oracle items
shell/expansion-orderandshell/brace-expansion. Brace-expanding data from a variable is also an injection-shaped bug (data turning into multiple words).Before / After
y='{a,b}'; echo $ya b{a,b}n=3; echo {1..$n}1 2 3{1..3}echo {01..10..3}1 4 7 1001 04 07 10echo "{a,b}"x{1,2}{a,b}x 1 2{a,b}x1 {a,b}x2echo '{a,b}'{c,d}{a,b} c d{a,b}c {a,b}decho {a,"b c"}a "b c"a b cecho {x}{a,b}{x} a b{x}a {x}becho {,a}aaecho a{b\,c,d}ab\ ac adab,c adNew spec
brace-expansion-order.test.sh(7 cases, verified against bash);brace_empty_itemlost itsbash_diff.Risk
Medium: lexer change for words containing
{. All lib, integration (spec) and bash_comparison tests pass. Known gap, recorded in limitations: bash expands raw text, so$v{1,2}reads$v1; we keep$vand append.Checklist
cargo fmt,cargo clippy -D warningshttps://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code