fix(parser): preserve quote metadata for mixed quoted/unquoted words#2054
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 3e331c3 | Commit Preview URL Branch Preview URL |
Jun 12 2026, 10:31 AM |
There was a problem hiding this comment.
Pull request overview
Fixes a lexer/tokenization issue where words that mix quoted and unquoted segments (notably those starting with a quoted segment like "foo"bar / <<"EOF"x) could lose quote metadata, leading to incorrect downstream expansion behavior (glob/brace expansion, heredoc-body expansion).
Changes:
- Adjust
read_double_quoted_stringto preserve quote metadata when concatenating adjacent unquoted content by returningQuotedWord/QuotedGlobWordinstead of downgrading toWord. - Simplify the double-quote lexing path by removing the now-unused
has_quoted_expansiontracking. - Add integration regression tests for partially quoted heredoc delimiters and mixed quoted/unquoted words involving glob/brace metacharacters.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/bashkit/src/parser/lexer.rs | Changes token classification for double-quoted strings with continuations to preserve quote metadata (incl. QuotedGlobWord path). |
| crates/bashkit/tests/integration/blackbox_security_tests.rs | Adds regression coverage for partially quoted heredoc delimiters and mixed quoted/unquoted words. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…harden regression tests
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.
Closes #2045
Words mixing quoted and unquoted segments (e.g.
"*"*.txt) lost quote metadata during lexing: quoted-segment metacharacters were passed raw to glob expansion, causing them to expand. Escapes glob metacharacters in quoted ranges before returningQuotedGlobWord, and tightens regression tests to create matching files so a broken lexer would fail deterministically.