Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(uninstall): make the uninstaller parse on macOS bash 3.2 (BUG-091)

Ruben Lütkefe8c84d08969
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 37a5154606..85acde15af 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -293,6 +293,33 @@ jobs:
- name: Target-resolved portable install matrix (BLOCKING)
run: python scripts/ci/check_portable_install_matrix.py --jobs 4
+ # macOS still ships GNU bash 3.2 (2007) as /bin/bash, while every runner and
+ # dev box here has bash 4/5. A script can therefore be valid everywhere we
+ # look and still fail to PARSE on a Mac - meaning not one line of it runs.
+ # That shipped: install/uninstall.sh in v1.1.0/v1.1.1 died with
+ # `syntax error near unexpected token ';;'` on every Mac, because bash 3.2
+ # cannot read a `case` arm inside a $( ) substitution. Nothing in CI parsed a
+ # shell script against 3.2, so nothing caught it. This does, for pennies: a
+ # parse check in a bash:3.2 container, never an execution. Own job (stdlib +
+ # Docker only, no pip install), BLOCKING.
+ shell-portability:
+ name: shell portability (parses on macOS bash 3.2)
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ - name: Checkout
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ persist-credentials: false
+
+ - name: Set up Python 3.11
+ uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
+ with:
+ python-version: "3.11"
+
+ - name: bash 3.2 parse gate (BLOCKING)
+ run: python scripts/ci/check_shell_bash32.py --require
+
# Output Language Policy enforcement (CLAUDE.md, HIGHEST PRIORITY): block any
# NEWLY ADDED German text from reaching GitHub. Diff-based, so the in-flight
# DE->EN translation backlog (pre-existing German) does NOT turn this red - only
diff --git a/docs/BUGS.md b/docs/BUGS.md
index a74ebc3ca9..61323f1d63 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -6227,3 +6227,78 @@ authoritative "this voice actually spoke" signal must be attachable to the
turn it describes even when playback outlives the turn — a label that can
only land on an open turn silently disappears exactly when the fallback
path (the interesting case) is slow.
+
+---
+
+## BUG-091: The uninstall one-liner is DEAD on every Mac — bash 3.2 cannot parse `install/uninstall.sh` at all (HIGH, FIXED 2026-07-19)
+
+**Symptom (field report 2026-07-19, macOS test machine).** The documented
+uninstall command from README.md
+
+```bash
+bash ~/.personal-jarvis/install/uninstall.sh
+```
+
+prints a syntax error and nothing else. No banner, no prompt, nothing
+removed, exit 2:
+
+```
+~/.personal-jarvis/install/uninstall.sh: line 57: syntax error near unexpected token `;;'
+```
+
+**Root cause — a PARSE failure, so not one line of the script runs.** macOS
+still ships GNU bash **3.2.57 (2007)** as `/bin/bash`; Linux and Git Bash
+ship bash 4/5. `stop_running_instances()` put a `case` arm inside a `$( )`
+command substitution (`install/uninstall.sh:57`):
+
+```bash
+pids=$(ps -axo pid=,comm= 2>/dev/null | while read -r pid comm; do
+ case "$comm" in "$root"/*) printf '%s ' "$pid" ;; esac
+done) || true
+```
+
+The bash 3.2 parser reads the `)` that closes the case **pattern** as the end
+of the command substitution, then chokes on the `;;`. Because it is a parse
+error, the failure is total and happens before the first statement executes —
+which is why it reads as "the uninstaller does nothing" rather than "the
+uninstaller failed halfway".
+
+Version boundary verified in isolated containers: `bash 3.2.57` → parse error,
+`bash 4.4.23` → OK, `bash 5.2.37` → OK. Linux and Windows were never affected.
+
+**Origin and blast radius.** Introduced by 470da3ea (2026-07-18, "stop the
+running app before deleting the install folder"). The three earlier versions
+of the script parse cleanly on 3.2. Shipped in **v1.1.0 and v1.1.1**, so every
+Mac that updated to those releases has a completely dead uninstaller; a Mac
+still holding an older `~/.personal-jarvis` is unaffected.
+
+**Fix.** The optional leading parenthesis on the case pattern — POSIX, and
+parses on bash 3.2/4/5, zsh, and dash alike:
+
+```bash
+case "$comm" in ("$root"/*) printf '%s ' "$pid" ;; esac
+```
+
+Both arms in the function carry it, so a future move in or out of a
+substitution stays safe.
+
+**Why CI could not catch it (the real defect).** No workflow parsed a single
+shell script against bash 3.2. `fresh-install-smoke.yml` never executes
+`install.sh` — it reconstructs the venv by hand — and no workflow invokes
+`uninstall.sh` at all. Green CI on Linux and Windows said nothing about the
+one shell version macOS actually uses.
+
+New gate: `scripts/ci/check_shell_bash32.py` parses **every** tracked `*.sh`
+with real bash 3.2 (`bash -n`, never an execution) and is wired into `ci.yml`
+as the BLOCKING `shell-portability` job. It picks its engine portably — a
+Mac's native `/bin/bash` when that is 3.2, otherwise the `bash:3.2` Docker
+image — and skips with an honest message where neither exists, unless
+`--require` (what CI passes) turns the skip into a failure. Verified in both
+directions: red on the pre-fix file with the exact field error text, green on
+the fix and on all 7 tracked scripts.
+
+**Lesson.** "Runs on Linux and Git Bash" proves nothing about macOS for a
+shell script: the Mac is a full bash MAJOR VERSION behind, and the failure
+mode is not a runtime bug but a dead file. Any shell artifact we ship to end
+users must be parse-checked against 3.2 — the same OS-parity discipline
+CLAUDE.md section 3 demands of Python and OS-specific backends.
diff --git a/install/uninstall.sh b/install/uninstall.sh
index f3ef544de4..cfbfb4f9d6 100644
--- a/install/uninstall.sh
+++ b/install/uninstall.sh
@@ -47,14 +47,23 @@ stop_running_instances() {
[ "$pid" = "$$" ] && continue
[ "$pid" = "${PPID:-0}" ] && continue
target=$(readlink "$exe" 2>/dev/null) || continue
- case "$target" in "$root"/*) pids="$pids $pid" ;; esac
+ case "$target" in ("$root"/*) pids="$pids $pid" ;; esac
done
else
# macOS/BSD: ps reports the full executable path in comm.
+ #
+ # The leading "(" on the case pattern is REQUIRED, not style: bash 3.2
+ # — the version macOS still ships — cannot parse a bare `pattern)` case
+ # arm inside a $( ) command substitution. Its parser takes that ")" as
+ # the end of the substitution and the whole FILE fails to parse:
+ # uninstall.sh: line 57: syntax error near unexpected token `;;'
+ # so not one line of the uninstaller runs. The optional leading "(" is
+ # POSIX and works on every shell we target. Both arms carry it so a
+ # future move in or out of a substitution stays safe.
pids=$(ps -axo pid=,comm= 2>/dev/null | while read -r pid comm; do
[ "$pid" = "$$" ] && continue
[ "$pid" = "${PPID:-0}" ] && continue
- case "$comm" in "$root"/*) printf '%s ' "$pid" ;; esac
+ case "$comm" in ("$root"/*) printf '%s ' "$pid" ;; esac
done) || true
fi
pids=$(printf '%s' "$pids" | tr -s ' ')
diff --git a/scripts/ci/check_shell_bash32.py b/scripts/ci/check_shell_bash32.py
new file mode 100644
index 0000000000..bfa29f9da0
--- /dev/null
+++ b/scripts/ci/check_shell_bash32.py
@@ -0,0 +1,176 @@
+"""Parse every tracked shell script with bash 3.2 - the version macOS ships.
+
+Why this gate exists
+--------------------
+macOS still ships GNU bash 3.2.57 (2007) as `/bin/bash`; Linux and Git Bash
+ship bash 4/5. A script can therefore be perfectly valid on every developer
+machine and CI runner we own, yet fail to PARSE on a Mac - which means not one
+line of it runs.
+
+That is not hypothetical. `install/uninstall.sh` shipped in v1.1.0 and v1.1.1
+with a `case` arm inside a `$( )` command substitution:
+
+ pids=$(ps -axo pid=,comm= | while read -r pid comm; do
+ case "$comm" in "$root"/*) printf '%s ' "$pid" ;; esac
+ done)
+
+The bash 3.2 parser reads the `)` that closes the case PATTERN as the end of
+the command substitution, so the whole file dies with
+
+ uninstall.sh: line 57: syntax error near unexpected token `;;'
+
+Every Mac on v1.1.0+ had a completely dead uninstaller. The optional leading
+`(` on a case pattern - `case "$x" in ("$root"/*) ... ;; esac` - is POSIX and
+fixes it on every shell we target.
+
+No existing workflow parsed a single shell script against bash 3.2, so nothing
+could have caught it. This gate does, and it is cheap: a parse check, never an
+execution.
+
+Engine selection (portable by design, per CLAUDE.md section 3)
+-------------------------------------------------------------
+1. A local `/bin/bash` that IS 3.2 - the real thing, on a Mac. No Docker.
+2. Docker image `bash:3.2` - on Linux/Windows dev boxes and CI.
+3. Neither available: report and skip, so a contributor without Docker is not
+ blocked. CI passes `--require` to turn that skip into a hard failure.
+
+Usage:
+ python scripts/ci/check_shell_bash32.py # local, skips if no engine
+ python scripts/ci/check_shell_bash32.py --require # CI: no engine == failure
+"""
+
+from __future__ import annotations
+
+import argparse
+import shutil
+import subprocess
+import sys
+from pathlib import Path
+
+REPO_ROOT = Path(__file__).resolve().parents[2]
+BASH32_IMAGE = "bash:3.2"
+
+
+def _run(cmd: list[str], **kw: object) -> subprocess.CompletedProcess[str]:
+ return subprocess.run( # noqa: S603 - fixed argv, no shell
+ cmd, capture_output=True, text=True, encoding="utf-8", errors="replace", **kw
+ )
+
+
+def tracked_shell_scripts() -> list[str]:
+ """Repo-relative POSIX paths of every git-tracked *.sh file."""
+ out = _run(["git", "-C", str(REPO_ROOT), "ls-files", "*.sh"])
+ if out.returncode != 0:
+ print(f"ERROR: could not list tracked files: {out.stderr.strip()}", file=sys.stderr)
+ raise SystemExit(2)
+ return sorted(
+ line.strip().replace("\\", "/") for line in out.stdout.splitlines() if line.strip()
+ )
+
+
+def local_bash32() -> str | None:
+ """Path to a local bash that is 3.2 (i.e. we are on a Mac), else None."""
+ for candidate in ("/bin/bash", shutil.which("bash") or ""):
+ if not candidate or not Path(candidate).exists():
+ continue
+ probe = _run([candidate, "--version"])
+ if probe.returncode == 0 and "version 3.2" in probe.stdout:
+ return candidate
+ return None
+
+
+def docker_available() -> bool:
+ return shutil.which("docker") is not None and _run(["docker", "info"]).returncode == 0
+
+
+def parse_with_local(bash: str, scripts: list[str]) -> dict[str, str]:
+ failures: dict[str, str] = {}
+ for rel in scripts:
+ got = _run([bash, "-n", str(REPO_ROOT / rel)])
+ if got.returncode != 0:
+ failures[rel] = got.stderr.strip()
+ return failures
+
+
+def parse_with_docker(scripts: list[str]) -> dict[str, str]:
+ """One container for all scripts; `bash -n` parses, never executes."""
+ # Marker-delimited output so a per-file verdict survives the shared stderr.
+ script = "\n".join(
+ f'printf "@@ {rel}\\n"; bash -n "/w/{rel}" 2>&1 || printf "@@FAIL {rel}\\n"'
+ for rel in scripts
+ )
+ mount = f"{REPO_ROOT.as_posix()}:/w:ro"
+ got = _run(["docker", "run", "--rm", "-v", mount, BASH32_IMAGE, "sh", "-c", script])
+ if got.returncode != 0 and not got.stdout:
+ print(f"ERROR: bash 3.2 container failed to start: {got.stderr.strip()}", file=sys.stderr)
+ raise SystemExit(2)
+
+ failures: dict[str, str] = {}
+ current, buffer = None, []
+ for line in got.stdout.splitlines():
+ if line.startswith("@@FAIL "):
+ failures[line[7:].strip()] = "\n".join(buffer).strip()
+ elif line.startswith("@@ "):
+ current, buffer = line[3:].strip(), []
+ elif current:
+ buffer.append(line)
+ return failures
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser(description=__doc__)
+ ap.add_argument(
+ "--require",
+ action="store_true",
+ help="Fail when no bash 3.2 engine is available (CI) instead of skipping.",
+ )
+ args = ap.parse_args()
+
+ scripts = tracked_shell_scripts()
+ if not scripts:
+ print("No tracked *.sh files - nothing to check.")
+ return 0
+
+ if (bash := local_bash32()) is not None:
+ print(f"Engine: local {bash} (bash 3.2 - native macOS)")
+ failures = parse_with_local(bash, scripts)
+ elif docker_available():
+ print(f"Engine: docker {BASH32_IMAGE}")
+ failures = parse_with_docker(scripts)
+ else:
+ message = (
+ "No bash 3.2 available (need a Mac's /bin/bash or Docker for "
+ f"{BASH32_IMAGE}). macOS parse-compatibility was NOT verified."
+ )
+ if args.require:
+ print(f"FAIL: {message}", file=sys.stderr)
+ return 1
+ print(f"SKIP: {message}")
+ return 0
+
+ for rel in scripts:
+ print(f" {'FAIL' if rel in failures else 'ok '} {rel}")
+
+ if failures:
+ print(
+ f"\nFAIL: {len(failures)} shell script(s) do not PARSE under bash 3.2, "
+ "so they run on Linux and Git Bash but are dead on macOS.\n",
+ file=sys.stderr,
+ )
+ for rel, err in failures.items():
+ print(f"--- {rel} ---\n{err}\n", file=sys.stderr)
+ print(
+ "Common cause: a `case` arm inside a $( ) command substitution. bash 3.2 "
+ "reads the pattern's `)` as the end of the substitution. Add the optional "
+ 'leading parenthesis - `case "$x" in (pattern) ... ;; esac` - which is '
+ "POSIX and parses on every shell we target.",
+ file=sys.stderr,
+ )
+ return 1
+
+ print(f"\nOK: all {len(scripts)} tracked shell script(s) parse under bash 3.2 (macOS).")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())