Skip to content

fix: restore stock macOS Bash compatibility - #3732

Merged
kunchenguid merged 1 commit into
kunchenguid:mainfrom
3264studios:fm/fm-bash32-upstream-fixes
Sep 6, 2026
Merged

kunchenguid merged 1 commit into
kunchenguid:mainfrom
3264studios:fm/fm-bash32-upstream-fixes

Conversation

@3264studios

@3264studios 3264studios commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Four tests fail on stock macOS Bash 3.2 at pristine upstream main and pass on the same host and tree when only Bash on PATH changes to modern Bash. They are two distinct defects, one in a test fixture and one in product code.

1. Composer fixture (test-only). tests/fm-composer-lib.test.sh builds its half-block fixture with ANSI-C \u escapes, which Bash 3.2 emits literally because Unicode escapes require Bash 4.2 or newer. fm_composer_row_has_edge therefore receives the ASCII text \u2580 instead of the ▀ glyph. The product matcher is correct; only the fixture is wrong. Replaced with literal UTF-8 glyphs, matching every other fixture in the file. No product code changes.

2. Remote home seed (product defect). bin/fm-remote-home-seed.sh runs under set -eu, initialises PROJECT_NAMES as an empty array for --no-projects, then expands "${PROJECT_NAMES[@]}". Bash 3.2 treats that empty expansion as an unbound variable and aborts the seed; Bash 4.4+ treats it as a no-op. The script's own usage header documents --no-projects as a supported way to seed with an empty project list, so on stock macOS Bash that documented path cannot complete. Fixed with the repository's existing guarded-array form; sibling arrays were checked for the same exposure. The remote trace-context and lifecycle test failures are two symptoms of this one defect, not independent confirmations.

bash -n parses the defective seed script clean under Bash 3.2, so the existing macOS parse sweep cannot catch this: it is a runtime failure, not a syntax error. Both changes are proven red-before / green-after on Apple's /bin/bash 3.2.57 and green-before / green-after on Bash 5.3, with logs linked below.

What Changed

  • Guard empty PROJECT_NAMES iteration with the repository’s Bash 3.2-safe array expansion so --no-projects remote seeding does not fail under set -u.
  • Replace Bash 4.2-only Unicode escapes in the Herdr composer fixture