Skip to content

fix(parser): preserve quote metadata for mixed quoted/unquoted words#2054

Merged
chaliy merged 2 commits into
mainfrom
fix/pr-2045-parser-quote-metadata
Jun 12, 2026
Merged

fix(parser): preserve quote metadata for mixed quoted/unquoted words#2054
chaliy merged 2 commits into
mainfrom
fix/pr-2045-parser-quote-metadata

Conversation

@chaliy

@chaliy chaliy commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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 returning QuotedGlobWord, and tightens regression tests to create matching files so a broken lexer would fail deterministically.

Copilot AI review requested due to automatic review settings June 12, 2026 10:01
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 12, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_string to preserve quote metadata when concatenating adjacent unquoted content by returning QuotedWord/QuotedGlobWord instead of downgrading to Word.
  • Simplify the double-quote lexing path by removing the now-unused has_quoted_expansion tracking.
  • 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.

Comment thread crates/bashkit/src/parser/lexer.rs
Comment thread crates/bashkit/tests/integration/blackbox_security_tests.rs
@chaliy chaliy merged commit 3f396f0 into main Jun 12, 2026
35 checks passed
@chaliy chaliy deleted the fix/pr-2045-parser-quote-metadata branch June 12, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants