From ebe327ddb54e00f7a901ce7eafbd9b1abc7dc90c Mon Sep 17 00:00:00 2001 From: ayaangazali Date: Mon, 17 Aug 2026 10:20:26 -0700 Subject: [PATCH] fix(gates): drop mapfile so the hardcoded-defaults gate runs on macOS `mapfile` is bash 4. macOS ships bash 3.2 as /bin/bash, so the gate exits 127 with `mapfile: command not found` before it reads a single file. It only ever passes because the centralization job runs on ubuntu-22.04. Two sibling scripts already state this constraint and avoid the same builtins for it: bindings/swift/scripts/sync-dist-repo.sh:178 Built with read loops rather than `mapfile`: macOS ships bash 3.2, which has no mapfile, and this script must run on a stock macOS release runner. scripts/build/build-core-android.sh:65 ...array (`declare -A`) so this script works on macOS' default /bin/bash 3.2 This gate is the one place that breaks the rule, and it breaks it exactly when a contributor on a Mac tries to reproduce a red gate locally: instead of the list of offending files they get a bash error. Replaced with the read loop the sibling scripts use. `FILES` stays an array, so `${FILES[@]}` / `${#FILES[@]}` and `--list` are unchanged. --- scripts/validation/gates/check_no_hardcoded_defaults.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/validation/gates/check_no_hardcoded_defaults.sh b/scripts/validation/gates/check_no_hardcoded_defaults.sh index 5583935f4..be27c7d73 100755 --- a/scripts/validation/gates/check_no_hardcoded_defaults.sh +++ b/scripts/validation/gates/check_no_hardcoded_defaults.sh @@ -67,7 +67,14 @@ LIST_ONLY=0 # node_modules, build, dist not source # DevTools, Playground, examples not shipped SDK surface # --------------------------------------------------------------------------- -mapfile -t FILES < <( +# Read loop rather than `mapfile`: macOS ships bash 3.2, which has no mapfile, +# and this gate has to be runnable locally to reproduce a CI failure. Same +# reasoning as bindings/swift/scripts/sync-dist-repo.sh and +# scripts/build/build-core-android.sh. +FILES=() +while IFS= read -r _file; do + FILES+=("$_file") +done < <( find \ bindings/swift/Sources \ bindings/kotlin/src/main \