fix(bootstrap-repo): mapfile portability for bash 3.2 (macOS)#268
Merged
fix(bootstrap-repo): mapfile portability for bash 3.2 (macOS)#268
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apply_branch_protection.shusedmapfile -t, a bash 4+ builtin. macOS ships bash 3.2 by default, so the bootstrap fails at the protection step:Replaces with a portable
while IFS= read -rloop that builds theCONTEXTSarray 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 earlierbootstrap-test-DELETE-MEdry-run had nopull_requestworkflows so the mapfile branch wasn't taken.magnet-handlerhas aciworkflow, which is what triggered the discovery code path for the first time.magnet-handler bootstrap completed end-to-end after manually applying this fix:
ci).github/bootstrapped-repos.json)Test plan
shellcheckpassesmapfileusages in the skill (grep clean)