Skip to content

fix(interpreter): toggle case, prefix-name splitting, mapfile options - #2601

Merged
chaliy merged 1 commit into
mainfrom
claude/param-expansion-gaps
Oct 7, 2026
Merged

chaliy merged 1 commit into
mainfrom
claude/param-expansion-gaps

Conversation

@chaliy

@chaliy chaliy commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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

What changed

  • ${v~} and ${v~~} toggle case (first char / all chars), also per element for ${a[@]~~}.
  • \/ in a ${v/pat/rep} replacement is a plain /, so ${p//./\/} turns a.b.c into a/b/c.
  • Unquoted ${!prefix@}, ${!ref}, ${v:off:len}, ${a[@]:o:n} and ${v@op} now go through IFS field splitting like $v does, so for v in ${!cfg_@} loops once per name.
  • mapfile/readarray gained -d DELIM ('' is NUL), -n COUNT, -s COUNT, -O ORIGIN (keeps the other elements) and grouped options like -tn1. Unknown options, -u FD other than 0 and the -C/-c callback exit 2 with a message (L-MAPFILE-001). Before, an option value like , in -d , was taken as the array name.

Why

Debian-oracle cases param-case-modification, param-replace, param-indirect-and-names and mapfile-readarray failed on these.

Before / After

Script Before After (matches bash)
s="hello World"; echo "${s~~}" hello World HELLO wORLD
p=a.b.c; echo "${p//./\/}" a\/b\/c a/b/c
for v in ${!cfg_@}; do echo $v; done cfg_host cfg_port (one pass) two passes
mapfile -t -d , f <<< "a,b,c" empty array [a][b][c\n]
readarray -t -s 1 -n 2 p < f all lines lines 2 and 3

New spec file param-expansion-gaps.test.sh (7 cases), verified against bash 5.2. The bashbox case mapfile_on_nul_delimiters is no longer skipped.

Risk

Medium-low. Field splitting now applies to more unquoted expansion kinds; that matches bash, and the full spec, integration and bash-comparison suites pass. The recursion stack probe is unchanged (2032–2036 KB, main 2028–2036 KB).

Checklist

  • Failing spec first, verified against real bash
  • cargo test -p bashkit --lib, --test integration, bash_comparison
  • cargo clippy --all-targets -D warnings, cargo fmt --check
  • knowledge (log.md, limitations L-MAPFILE-001) updated

https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA


Generated by Claude Code

@chaliy chaliy self-assigned this Oct 7, 2026
@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 0a6ce1e Commit Preview URL

Branch Preview URL
Oct 07 2026, 10:02 PM

@chaliy
chaliy force-pushed the claude/param-expansion-gaps branch from 7136e5c to e4c7d23 Compare October 7, 2026 21:42
${v~}/${v~~} toggle case; "\/" in a replacement is a plain slash; unquoted
${!pre@}, ${!ref}, substrings, slices and ${v@op} are field-split; mapfile
supports -d, -n, -s, -O and grouped options.

Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
@chaliy
chaliy force-pushed the claude/param-expansion-gaps branch from e4c7d23 to 0a6ce1e Compare October 7, 2026 22:01
@chaliy
chaliy merged commit 6bebfd0 into main Oct 7, 2026
44 checks passed
@chaliy
chaliy deleted the claude/param-expansion-gaps branch October 7, 2026 22:22
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