From ec62668bb5baca0fc1b413c80012725d2a4f9118 Mon Sep 17 00:00:00 2001 From: Nakanokensetsu <281529662+Nakanokensetsu@users.noreply.github.com> Date: Fri, 11 Sep 2026 22:07:02 +0900 Subject: [PATCH] fix(ci): guard empty commits[@] expansion in reconcile_platform_wheels.sh "${commits[@]}" on a genuinely empty array (zero commits to reconcile) triggers "unbound variable" under `set -u` on bash < 4.4. macOS ships bash 3.2.57 as /bin/bash, which the Metal nightly (Apple Silicon) runner picks up via the script's `#!/usr/bin/env bash` shebang, so the job has failed every run since 2026-08-18 whenever the platform is already caught up with target_commit (0 commits to reconcile). ${#commits[@]} (count) is safe either way, so gate the loop on that instead of expanding the array directly. Fixes #1768 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01G44KU7EBqqzdfE85y78gda --- .github/scripts/reconcile_platform_wheels.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/scripts/reconcile_platform_wheels.sh b/.github/scripts/reconcile_platform_wheels.sh index e9d4f66d4c..5c5b844c50 100755 --- a/.github/scripts/reconcile_platform_wheels.sh +++ b/.github/scripts/reconcile_platform_wheels.sh @@ -181,6 +181,10 @@ echo "Platform: ${PLATFORM_BACKEND}/${PLATFORM_ARCHITECTURE}" echo "Last contiguous build: ${last_built:-none}" echo "Commits requiring reconciliation: ${#commits[@]}" +# "${commits[@]}" on a genuinely empty array trips "unbound variable" under +# `set -u` on bash < 4.4 (macOS system /bin/bash is 3.2.57); ${#commits[@]} +# is safe either way, so gate the loop on the count instead. +if ((${#commits[@]} > 0)); then for commit in "${commits[@]}"; do restore_tracked_build_changes git checkout --detach "$commit" @@ -229,6 +233,7 @@ for commit in "${commits[@]}"; do printf '%s\n' "$commit" | "$rclone" rcat "$state_remote" done +fi restore_tracked_build_changes git checkout --detach "$target_commit"