Skip to content

fix(bootstrap-repo): mapfile portability for bash 3.2 (macOS)#268

Merged
jdfalk merged 1 commit intomainfrom
fix/bootstrap-mapfile-portability
Apr 25, 2026
Merged

fix(bootstrap-repo): mapfile portability for bash 3.2 (macOS)#268
jdfalk merged 1 commit intomainfrom
fix/bootstrap-mapfile-portability

Conversation

@jdfalk
Copy link
Copy Markdown
Owner

@jdfalk jdfalk commented Apr 25, 2026

Summary

apply_branch_protection.sh used mapfile -t, a bash 4+ builtin. macOS ships bash 3.2 by default, so the bootstrap fails at the protection step:

apply_branch_protection.sh: line 27: mapfile: command not found

Replaces with a portable while IFS= read -r loop that builds the CONTEXTS array incrementally. Same behavior, no bash version dependency.

How discovered

While running bootstrap_repo.sh --flavor cli --mode adopt --name magnet-handler (the first real-world adoption). The earlier bootstrap-test-DELETE-ME dry-run had no pull_request workflows so the mapfile branch wasn't taken. magnet-handler has a ci workflow, which is what triggered the discovery code path for the first time.

magnet-handler bootstrap completed end-to-end after manually applying this fix:

  • Repo settings ✓
  • Sync from ghcommon ✓ (51 files, 11057 insertions)
  • Labels ✓ (189/242, rate-limit on remainder)
  • CLI flavor overlay ✓ (CHANGELOG.md seeded)
  • Bootstrap commit pushed ✓
  • Branch protection ✓ (with the fix; 1 required check ci)
  • Registry updated ✓ (.github/bootstrapped-repos.json)
  • verify_bootstrap.sh exit 0 ✓

Test plan

  • shellcheck passes
  • Direct invocation against magnet-handler succeeds with bash 3.2
  • No other mapfile usages in the skill (grep clean)

Surfaced when running bootstrap_repo.sh against jdfalk/magnet-handler
on macOS:

  apply_branch_protection.sh: line 27: mapfile: command not found

mapfile is a bash 4+ builtin; macOS ships bash 3.2 by default.
Replace with a portable while-read loop that builds the CONTEXTS array
incrementally. Same behavior, no bash version dependency.

Tested: re-running apply_branch_protection.sh on magnet-handler with
the fix applies protection successfully (1 required check 'ci'
discovered from the workflow).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added size/XS tech:shell Shell scripting (bash, sh) and removed size/XS labels Apr 25, 2026
@jdfalk jdfalk merged commit ec6ba08 into main Apr 25, 2026
36 of 39 checks passed
@jdfalk jdfalk deleted the fix/bootstrap-mapfile-portability branch April 25, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tech:shell Shell scripting (bash, sh)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant