Skip to content

fix(wrap): wrap runs on bash 3.2 again, parse and run check - #1262

Merged
tieubao merged 5 commits into
masterfrom
l312-bash32-hotfix
Dec 2, 2026
Merged

tieubao merged 5 commits into
masterfrom
l312-bash32-hotfix

Conversation

@tieubao

@tieubao tieubao commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

What

Wrap from PR 1257 failed on macOS /bin/bash 3.2, the shell the kit supports.

  1. lib/wrap/wrap-session.sh: bash 3.2 reads an apostrophe in a comment inside a command substitution as a quote, which left a quote open until the jq program (syntax error at line 740). Two case clauses inside a command substitution also needed the parenthesized form.
  2. lib/wrap/report-lint.sh: an empty built_items list failed under set -u.
  3. New tests/test-bash32-parse.sh: stage 1 parses every shipped shell file (272) with /bin/bash -n; stage 2 runs wrap session (json and summary, with a transcript fixture) and report-lint (empty built list) on /bin/bash 3.2 and checks the output and stderr. It prints whether it ran or skipped.

CI missed it because the macOS jobs put Homebrew bash 5 first on PATH.

Demo

/bin/bash -n lib/wrap/wrap-session.sh: syntax error before, clean after.

Proof

docs/verification/l312-bash32-hotfix.md

  • Verdict: works: every wrap verb runs clean on /bin/bash 3.2 with output unchanged.
  • Proof: wrap session output identical before and after on bash 5 and 3.2; test-wrap-session 159/159 and test-wrap-report-lint 184/184 on both; reverting the case clauses or the report-lint guard turns the new suite red; a fresh review ran 12 wrap verb runs on the real /bin/bash.
  • Risk: test-only addition plus syntax-level edits; undo with a revert.
  • Needs Han: nothing.

Bookkeeping

no-board-row: regression fix tracked on the devkit leftovers item

Fixes bash 3.2 parse and runtime regressions in wrap-session.sh and report-lint.sh:
- Remove unmatched apostrophes and backticks from comments inside command substitutions in _session_transcript_json (bash 3.2 parse_comsub tracked them as quotes, causing a syntax error at line 740).
- Use POSIX balanced parentheses on case clauses inside the acted command substitution.
- Move the multi-line jq program in _session_summary_text into a quoted heredoc variable and add a shellcheck dialect header.
- Guard empty built_items array expansion in report-lint.sh under set -u for bash 3.2.
- Add always-on tests/test-bash32-parse.sh to run /bin/bash -n over every shipped shell file on macOS (skips when /bin/bash is not 3.2) so the fast PR lane catches 3.2 parse errors.
Stage 1 (/bin/bash -n) cannot parse command substitutions inside double quotes or catch runtime empty-array errors under set -u. Stage 2 now runs bin/wrap session --json/--summary with a transcript fixture and lib/wrap/report-lint.sh on an empty built list under /bin/bash 3.2 (with bash shimmed to /bin/bash first on PATH) and asserts real output and clean stderr, and prints a clear RUNNING or SKIP status line.
@tieubao
tieubao merged commit 4cf068e into master Dec 2, 2026
8 checks passed
@tieubao
tieubao deleted the l312-bash32-hotfix branch December 2, 2026 10:09
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