Skip to content

fix(mac-launcher): bash 3.2-safe empty-array expansion (fixes "EXTRA[@]: unbound variable")#154

Merged
cursor[bot] merged 1 commit into
mainfrom
AgentMemory/mac-launcher-empty-array-fix-2815
Jun 18, 2026
Merged

fix(mac-launcher): bash 3.2-safe empty-array expansion (fixes "EXTRA[@]: unbound variable")#154
cursor[bot] merged 1 commit into
mainfrom
AgentMemory/mac-launcher-empty-array-fix-2815

Conversation

@FluffyAIcode

Copy link
Copy Markdown
Owner

Summary

scripts/run_kakeya_mac.sh died with line 83: EXTRA[@]: unbound variable when run with no pass-through args (the common interactive case).

Root cause

The script uses set -euo pipefail (nounset) and expanded a possibly-empty array with a bare "${EXTRA[@]}". macOS's default /bin/bash is 3.2 (Apple froze it at GPLv2), where expanding an empty array under nounset is treated as an unbound-variable error. (bash ≥4.4 — e.g. my Linux dev shell — does not error, which is why it slipped through.) With pass-through args EXTRA is non-empty so it worked; with none it crashed.

Fix

Use the canonical bash-3.2-safe form ${EXTRA[@]+"${EXTRA[@]}"} — expands to the quoted elements when set, to nothing when empty, and never trips nounset.

Validation (Mac M4, on the actual /bin/bash 3.2)

New mlx-kakeya-launcher-dryrun-bash32 preset runs /bin/bash scripts/run_kakeya_mac.sh --dry-run (empty EXTRA, the exact failing condition). Result: exit 0, prints the resolved command — no EXTRA[@]: unbound variable. Pre-fix it died at line 83 on the same bash.

Also verified locally: dry-run with empty EXTRA (works), with pass-through args (included), and the idiom under set -u (empty → nothing, populated → elements).

Testing

  • ✅ On-device mlx-kakeya-launcher-dryrun-bash32 on macOS /bin/bash 3.2 (exit 0, command printed)
  • pytest tests/inference_engine/bridge/test_manifest.py (31 passed)
  • bash -n scripts/run_kakeya_mac.sh

Independent fix off main. Note: pending launcher PRs #148/#150 also touch this file; whichever merges after should keep the ${EXTRA[@]+…} form.

Open in Web Open in Cursor 

…ound variable)

scripts/run_kakeya_mac.sh used 'set -u' + a bare "${EXTRA[@]}". macOS's default
/bin/bash is 3.2, where expanding an EMPTY array under nounset errors with
'EXTRA[@]: unbound variable' — hit when the launcher is run with no pass-through
args (the common interactive case). Use the canonical ${EXTRA[@]+"${EXTRA[@]}"}
form (elements if set, nothing if empty, no nounset error). Add
mlx-kakeya-launcher-dryrun-bash32 preset to guard it on the real /bin/bash 3.2.

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
@cursor cursor Bot merged commit 5bece7b into main Jun 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants