Skip to content

Launcher scripts fail to parse under bash 3.2 (macOS /bin/bash) since fad239e #314

Description

@p4elkin

All three launcher scripts fail to parse under bash 3.2, which is the bash macOS ships as /bin/bash. Every plugin-launched review exits without running revdiff.

fad239e (#309) added this comment inside the iTerm2 <<'APPLESCRIPT' heredoc:

-- the tab label comes from its active session's name,
-- and the split gets none of its own: it copies the
-- parent's profile but not the session variables that
-- profile's name may interpolate

Three apostrophes: session's, parent's, profile's. The heredoc is nested inside a $( ) command substitution, and bash 3.2 scans the command substitution for quotes before it processes the heredoc, so an odd number of apostrophes there opens a quote that never closes. Everything after it misparses.

The error is reported about a hundred lines later, in the emacs branch, on a line that is perfectly valid:

line 628: syntax error near unexpected token `)'
line 628: `      (when-let* ((f (cl-find-if (lambda (f) (string= (frame-parameter f 'name) \"$ESCAPED_TITLE\")) (frame-list)))'

Reproduction

On macOS with the stock /bin/bash (3.2.57):

git clone https://github.com/umputun/revdiff && cd revdiff
bash -n .claude-plugin/skills/revdiff/scripts/launch-revdiff.sh   # exit 2
go test ./app/ -run TestShellLaunchersPreserveAnnotationExitCode  # FAIL

TestShellLaunchersPreserveAnnotationExitCode catches it — the failures are the iterm2 and emacs backends across all three launchers, asserting on the stderr the syntax error produces.

Affected files, all three carrying the same comment:

  • .claude-plugin/skills/revdiff/scripts/launch-revdiff.sh
  • plugins/codex/skills/revdiff/scripts/launch-revdiff.sh
  • plugins/revdiff-planning/scripts/launch-plan-review.sh

Why CI does not see it

Modern bash parses it fine, and so does zsh (zsh -n exits 0). It only shows up where env bash resolves to 3.2, which on a stock macOS install is everywhere — a Homebrew bash on PATH hides it.

Worth noting the count matters, not the presence: removing one apostrophe leaves two, they pair, and the file parses again. So a partial fix looks like a working fix.

Suggested fix

Reword to avoid apostrophes entirely, rather than balancing them:

-- the tab label comes from the name of its active session,
-- and the split gets none of its own: it copies the
-- parent profile but not the session variables that
-- profile name may interpolate

That is what I am running locally; bash -n exits 0 on all three files and the test passes. Happy to send it as a PR if useful.

Quoting the heredoc body differently, or escaping the apostrophes, would work too — the reword just seemed the smallest change that cannot regress the same way if the comment is edited later.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions