Skip to content

Commit ce5c63d

Browse files
kingbclaude
andauthored
fix(plugins): replace mapfile with while-read for bash 3.2 compat (#3636)
`mapfile` is a bash 4.0 builtin and is unavailable on macOS's system bash 3.2.57. Commit 4d63c18 ("fix(plugins): auto-discover databases instead of hardcoded list") introduced `mapfile -t PROD_DBS < <(...)` in both dolt-archive/run.sh and dolt-backup/run.sh. On macOS, every patrol invocation of these plugins exits 127 with: line 69: mapfile: command not found (dolt-archive) line 49: mapfile: command not found (dolt-backup) Impact: JSONL last-resort recovery layer (dolt-archive) and rsync-style Dolt backup (dolt-backup) silently fail on macOS. Both plugins are the operational safety net for beads databases. The bug is gated by the auto-discovery branch — passing explicit `--databases foo,bar` takes the IFS/read path and still works, which likely explains why the regression went unnoticed in manual testing. The default `DEFAULT_DBS="auto"` triggers the break for all scheduled runs. Fix: replace `mapfile -t ARR < <(...)` with the bash 3.2-compatible `ARR=(); while IFS= read -r line; do ARR+=("$line"); done < <(...)` pattern. Same fix was previously applied in commits e297e73 and 4c5f269 and subsequently regressed by 4d63c18. Verified on darwin25 / bash 3.2.57(1)-release: - plugins/dolt-archive/run.sh auto-discovers 16 production DBs - plugins/dolt-backup/run.sh --dry-run auto-discovers 16 production DBs - Both scripts run to completion with exit 0 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 40c43c1 commit ce5c63d

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

plugins/dolt-archive/run.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ dolt_query_json() {
6666

6767
# Auto-discover production databases or use the explicit list.
6868
if [[ "$DEFAULT_DBS" == "auto" ]]; then
69-
mapfile -t PROD_DBS < <(
69+
PROD_DBS=()
70+
while IFS= read -r line; do
71+
PROD_DBS+=("$line")
72+
done < <(
7073
dolt_query "" "SHOW DATABASES" \
7174
| grep -v -E '^(information_schema|mysql|dolt_cluster)$' \
7275
| grep -v -E '^(testdb_|beads_t|beads_pt|doctest_)'

plugins/dolt-backup/run.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ log() {
4646
if [[ -n "$EXPLICIT_DBS" ]]; then
4747
IFS=',' read -ra PROD_DBS <<< "$EXPLICIT_DBS"
4848
else
49-
mapfile -t PROD_DBS < <(
49+
PROD_DBS=()
50+
while IFS= read -r line; do
51+
PROD_DBS+=("$line")
52+
done < <(
5053
for d in "$DOLT_DATA_DIR"/*/; do
5154
name="$(basename "$d")"
5255
[[ -d "$d/.dolt" ]] || continue

0 commit comments

Comments
 (0)