Fix mapfile for macOS default bash 3.2 (sync.sh, pull.sh) - #1
Open
jackiexi1986-AI wants to merge 1 commit into
Open
jackiexi1986-AI wants to merge 1 commit into
jackiexi1986-AI wants to merge 1 commit into
Conversation
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.
Problem
On macOS the default
/bin/bashis 3.2 (3.2.57), which does not ship themapfile/readarraybuiltin (bash 4+). Three call sites usedmapfile -t ... < <(jq ...):scripts/sync.sh— jq branch, two places (group_names,paths). The script died withmapfile: command not found(exit 127) right before the grouped commits, so the sync never reachedgit push.scripts/pull.sh— one place (agent_rows, same jq +@tsvpattern). Identical failure when pulling per-agent rows.bash -ndoes not catch this (it is a runtime missing-builtin, not a syntax error), and since scripts declare#!/usr/bin/env bash, on stock macOS they always run under bash 3.2.Fix
Replace every
mapfile -t arr < <(cmd)with the bash 3.2-compatible idiom:Process substitution and
while readboth exist in bash 3.2, so behavior is unchanged on bash 4+/5.Verification (macOS stock bash 3.2.57)
/bin/bash -n scripts/sync.sh scripts/pull.sh scripts/nightly_sync.sh— clean.sync.shchain against a scratch workspace + local bare remote: secret scan passed, per-group commits (core/skills/memory) plus themisccatch-all commit created and pushed — exit 0.scripts/nightly_sync.shend-to-end against a real remote: export → secret scan → commit →git push -u origin main— exit 0.