Skip to content

Fix installer abort on macOS bash 3.2 fresh install - #27

Open
mahdi-salmanzade wants to merge 1 commit into
b-nnett:mainfrom
mahdi-salmanzade:main
Open

mahdi-salmanzade wants to merge 1 commit into
b-nnett:mainfrom
mahdi-salmanzade:main

Conversation

@mahdi-salmanzade

Copy link
Copy Markdown

The documented one-command install fails on a clean machine.

Problem

install.sh uses set -u and the README pipes it into /bin/bash, which on macOS is 3.2.57. In that shell, expanding an empty array as "${patch_arguments[@]}" is an unbound variable error rather than an empty expansion:

==> Installing locked build tools
==> Building and signing Codex Subscription Router
install.sh: line 137: patch_arguments[@]: unbound variable

patch_arguments only receives --force when a previous installation exists, so the array is empty precisely on the fresh-install path — the first thing a new user runs.

This is issue #16.

Fix

One line, using the empty-safe expansion:

-    python3 scripts/patch_app.py "${patch_arguments[@]}"
+    python3 scripts/patch_app.py ${patch_arguments[@]+"${patch_arguments[@]}"}

${arr[@]+"${arr[@]}"} expands to nothing when the array is empty and otherwise forwards every element quoted, so --force behaviour is unchanged.

Verification

macOS 26.6.2, GNU bash 3.2.57(1)-release (arm64-apple-darwin25), running the real install.sh with the build steps stubbed:

Case Before After
Fresh install (no existing app) unbound variable, exit 1 patcher invoked with no extra arguments
Existing install present n/a patcher invoked with --force

Repository checks pass: check:shell, check:python, release:check.

One note for maintainers

npm run check:shell is bash -n install.sh, which is parse-only. A set -u unbound-variable error is a runtime failure, so CI structurally cannot catch this class of bug — which is how it shipped. I kept this PR to the one-line fix per CONTRIBUTING, but you may want a smoke invocation under /bin/bash in CI. Happy to add it here or separately if useful.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RkmFsKx3RanHavCx7Xzy6c

install.sh runs under `set -u` and is documented to be piped into
/bin/bash, which on macOS is 3.2.57. In that shell, expanding an empty
array as "${patch_arguments[@]}" is an unbound-variable error rather
than an empty expansion, so a first-time install aborted at the patcher
invocation:

  install.sh: line 137: patch_arguments[@]: unbound variable

The array is only populated with --force when a previous installation
is present, so the failure hit exactly the fresh-install path.

Use the ${arr[@]+"${arr[@]}"} expansion, which is empty-safe on bash 3.2
and still forwards --force unchanged on a reinstall.

Verified on macOS 26.6.2 with GNU bash 3.2.57(1)-release, stubbing the
build steps: fresh install now invokes the patcher with no extra
arguments, and an existing installation still invokes it with --force.

Note that `npm run check:shell` is `bash -n install.sh`, a parse-only
check, so it cannot catch this class of runtime error.

Fixes b-nnett#16

Claude-Session: https://claude.ai/code/session_01RkmFsKx3RanHavCx7Xzy6c
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