Conversation
|
@trieloff is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
3050c93 to
f6822b1
Compare
🤖 auto-maintain reviewAutomated, advisory triage for
Review panel: 🟡 medium highest severity just-bash maintainer code review: 🟢 low
General code review: 🟢 low
Adversarial security: 🟢 low
Adversarial security (second opinion): 🟢 low
Standard Bash and host portability: 🟡 medium
Posted by auto-maintain. This automated code review is advisory; a human maintainer makes the call. |
f6822b1 to
0b70c7a
Compare
|
Addressed the append-assignment finding in 32e355d. The declaration expansion helper now accepts both |
The declaration expansion path rebuilt keyed elements after expansion but emitted their values without quotes. A value like [key]="two words" therefore reached declare as [key]=two words, and its parser silently retained only the first token. Keep the keyed prefix parseable while serializing the already-expanded value as a quoted, escaped string. Preserve both replacement and append operators so declare A+=(...) follows the same safe path without clearing existing entries. Co-authored-by: Codex <noreply@openai.com> Signed-off-by: Lars Trieloff <lars@trieloff.net>
0b70c7a to
32e355d
Compare
|
Verified this fix against the defect I reported in ai-ecoverse/slicc#3329, and checked the one thing in the diff that looked risky -- it is not: Keyed values are rebuilt inside double quotes with only Two neighbouring defects measured on 3.4.2 while testing, both outside this PR's scope:
If it is useful, the test matrix in |
Context
Fixes the upstream shell defect reported in ai-ecoverse/slicc#3329.
Problem
An associative-array compound assignment made through
declare -Asilently truncated every value at its first space:Keys and element counts stayed intact, and element-by-element assignment plus bare-array compound assignment were already correct, so the corruption was easy to miss until the value reached a later API call, filename, or commit message.
Cause
Literal assignment builtins (
declare,local,typeset,export, andreadonly) use a declaration-specific expansion helper so that assignment values do not undergo ordinary word splitting. That helper correctly expanded[k]="a b c"to one element, but reconstructed it as:The
declarebuiltin's array parser then treated the first space as the end of the value and retained onlya.Fix
Keep the keyed
[key]=prefix visible to the declaration parser, while serializing the already-expanded value as a quoted string. Backslashes and double quotes are escaped during that internal handoff, so whitespace, empty strings, quotes, and backslashes survive the second parse without being expanded again.The declaration helper now recognizes both replacement (
NAME=(...)) and append (NAME+=(...)) operators and preserves the operator when rebuilding the argument. This also fixes the review-discovereddeclare A+=([new]="two words")case without clearing existing entries.A patch changeset is included.
Tests
New focused regression coverage pins:
All expected bytes were checked against GNU bash 5.3.15. No Homebrew install was needed because
/opt/homebrew/bin/bashwas already GNU bash 5.3.15.Validation:
pnpm lint:fix: clean;pnpm typecheck: clean;pnpm knip: clean apart from the repository's two existing configuration hints;pnpm build: clean (the existing CJSimport.metawarnings remain);origin/mainworktree (four macOS special-mode assertions and six CPython-WASM worker/bundle cases). The remaining defense-in-depth lifecycle failure is order-dependent in the broad run and passes standalone on both this branch andorigin/main; none touches assignment expansion.Co-authored with Codex.