Skip to content

fix(lexer): keep $'\x1e' and $'\x1f' bytes as data - #2562

Merged
chaliy merged 1 commit into
mainfrom
claude/ansi-c-control-bytes
Oct 7, 2026
Merged

chaliy merged 1 commit into
mainfrom
claude/ansi-c-control-bytes

Conversation

@chaliy

@chaliy chaliy commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Requested by Михайло · project thread

What changed

$'\x1e' and $'\x1f' (the ASCII record and unit separators) now stay in the value. Before, they were silently dropped.

Why

The lexer uses those two bytes internally to mark quote boundaries, so the decoded ANSI-C bytes were read as markers and removed. That breaks a common idiom for composite associative-array keys, SEP=$'\x1f'; v["$section$SEP$key"]=.... Gap telemetry found it: the replayed config_ini_merge run printed nothing.

Before

$ printf '%s' $'a\x1fb' | od -An -c
   a   b

After

   a 037   b

New spec ansi-c-control-bytes.test.sh (4 cases) matches bash 5.2; all 4 fail on main.

Risk

Low. Decoded ANSI-C content now escapes those two bytes the same way it already escapes $, using the existing NUL sentinel. The literal-word path drops markers and decodes the sentinels in a single pass.

Checklist

  • Failing spec first, verified against bash
  • cargo test -p bashkit --lib --tests, clippy, fmt
  • knowledge/log.md

https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA


Generated by Claude Code

@chaliy chaliy self-assigned this Oct 7, 2026
@chaliy
chaliy force-pushed the claude/ansi-c-control-bytes branch from 4f259cc to 3fad28f Compare October 7, 2026 13:06
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 7, 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 925f088 Commit Preview URL

Branch Preview URL
Oct 07 2026, 01:38 PM

The decoded bytes collided with the lexer's quote-boundary markers and
were dropped, breaking SEP=$'\x1f' composite keys.

Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
@chaliy
chaliy force-pushed the claude/ansi-c-control-bytes branch from 3fad28f to 925f088 Compare October 7, 2026 13:37
@chaliy
chaliy merged commit f4f2261 into main Oct 7, 2026
43 checks passed
@chaliy
chaliy deleted the claude/ansi-c-control-bytes branch October 7, 2026 14:04
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.

1 participant