Skip to content

fix(cua-driver): parse uninstall.sh under macOS /bin/bash (bash 3.2) - #1723

Merged
f-trycua merged 1 commit into
trycua:mainfrom
DHMin:fix/uninstall-bash32-heredoc-eof
May 29, 2026
Merged

fix(cua-driver): parse uninstall.sh under macOS /bin/bash (bash 3.2)#1723
f-trycua merged 1 commit into
trycua:mainfrom
DHMin:fix/uninstall-bash32-heredoc-eof

Conversation

@DHMin

@DHMin DHMin commented May 26, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the cua-driver uninstaller libs/cua-driver/scripts/uninstall.sh so it parses under bash 3.2 — the /bin/bash shipped on macOS and the exact shell the documented one-liner invokes (/bin/bash -c "$(curl -fsSL …/uninstall.sh)").

Closes #1722.

Why

Under bash 3.2.57 the script aborts before doing anything:

uninstall.sh: line 324: unexpected EOF while looking for matching `)'
uninstall.sh: line 694: syntax error: unexpected end of file

bash 3.2 has a parser bug where a here-document inside a $( … ) command substitution is not skipped while scanning for the closing ). The Rust-branch Python here-doc (python3 <<'PY') carried three apostrophes in comments — Swift's, it's, shouldn't — an odd count, so bash 3.2 entered a phantom single-quoted string, never matched the ), and ran to EOF. The Swift branch's equivalent here-doc was already apostrophe-free, which is why only the Rust branch tripped. bash 4+/5+ (e.g. Homebrew bash) parse it correctly, so it only bites users running the documented /bin/bash flow.

Change

Reword those three comment lines to drop the contractions/possessives so the here-doc no longer contains unbalanced single quotes. No behavioral change — comments only.

Verification

$ /bin/bash --version | head -1
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin25)

# before
$ /bin/bash -n libs/cua-driver/scripts/uninstall.sh
uninstall.sh: line 324: unexpected EOF while looking for matching `)'
uninstall.sh: line 694: syntax error: unexpected end of file

# after
$ /bin/bash -n libs/cua-driver/scripts/uninstall.sh && echo OK
OK

Summary by CodeRabbit

  • Chores
    • Updated internal documentation in the uninstall script to clarify bundle-path handling logic.

Review Change Stack

bash 3.2 — the /bin/bash shipped on macOS and the shell the documented
install/uninstall one-liner invokes — does not skip here-document bodies
when scanning a $( ... ) command substitution. The Rust-branch Python
here-doc (python3 <<'PY') carried three apostrophes in comments
("Swift's", "it's", "shouldn't"), an odd count, so bash 3.2 entered a
phantom single-quoted string while hunting for the closing ) and ran to
end of file:

  uninstall.sh: line 324: unexpected EOF while looking for matching `)'
  uninstall.sh: line 694: syntax error: unexpected end of file

Reword those three comment lines to drop the contractions/possessives so
the here-doc no longer contains unbalanced single quotes. The Swift
branch's equivalent here-doc was already apostrophe-free, which is why
only the Rust branch tripped. No behavioral change; `bash -n` now passes
under bash 3.2.57.
@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

@DHMin is attempting to deploy a commit to the Cua Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 76429fe8-1941-4fa6-a8af-930a11ef0f9d

📥 Commits

Reviewing files that changed from the base of the PR and between 01bd10d and 091ae00.

📒 Files selected for processing (1)
  • libs/cua-driver/scripts/uninstall.sh

📝 Walkthrough

Walkthrough

The uninstall script's Python-based Claude MCP scrubber logic has its inline documentation clarified. A comment explaining how the /Applications/CuaDriver.app bundle path is matched now explicitly states this anchor is only counted as Rust when a Rust install marker is present; otherwise, it should be treated as a Swift registration. No behavior or control flow is changed.

Changes

Uninstall Script Comment Update

Layer / File(s) Summary
MCP registration matching rule clarification
libs/cua-driver/scripts/uninstall.sh
Comment in the Python Claude MCP scrubber function updated to explicitly document that the shared /Applications/CuaDriver.app bundle-path anchor is only treated as Rust when the Rust install marker is present; otherwise treated as Swift.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • trycua/cua#1558: The main PR's update to the inline Claude MCP scrubber/matching rule comment in libs/cua-driver/scripts/uninstall.sh is directly tied to this PR's uninstall.sh overhaul that governs Rust-vs-Swift uninstall behavior and related MCP cleanup.
  • trycua/cua#1665: Both PRs modify libs/cua-driver/scripts/uninstall.sh's Rust-vs-Swift uninstall selection logic (the retrieved PR consolidates/changes Rust handling inline, and this PR updates the /Applications/CuaDriver.app matching rule comment/annotation accordingly).
  • trycua/cua#1424: Both PRs touch libs/cua-driver/scripts/uninstall.sh's inline Python MCP-registration scrubber logic for identifying/removing the CuaDriver/Claude Code registrations (the main PR refines the "/Applications/CuaDriver.app" matching rule).

Poem

A comment once murmured in code now sings clear,
"Swift or Rust?" it now whispers, no longer unclear—
The bundle path knows its own home,
And bash 3.2 won't cause users to roam. 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main fix: correcting bash 3.2 parsing issues in the uninstall.sh script by rewording comments to remove apostrophes.
Linked Issues check ✅ Passed The PR fulfills issue #1722 requirements by removing unbalanced apostrophes from here-doc comments, enabling the script to parse under bash 3.2 as required.
Out of Scope Changes check ✅ Passed All changes are scoped to addressing the bash 3.2 parsing issue; only comment rewording in the uninstall.sh script with no behavioral modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@f-trycua
f-trycua merged commit d720891 into trycua:main May 29, 2026
1 of 2 checks passed
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.

uninstall.sh fails under macOS /bin/bash (bash 3.2): "unexpected EOF while looking for matching )"

2 participants