commit 4947d29f9526863273e0456517a6ec8ca8247c3e
parent e71fc1bd3e36d4e648e2f4355ccdf04a00a0fe8d
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Fri, 12 Jun 2026 11:45:43 -0700
fix(test): bash-3.2-safe empty-array expansion in exec_target podman path
Running a parse/etc. runner via macOS `sh` (= bash 3.2.57) instead of its
bash 5.3 shebang tripped `platform_flag[@]: unbound variable` under the
`set -u` the runners enable. Native targets (e.g. aarch64-linux-gnu on the
arm64 podman VM) leave platform_flag empty, and bare "${arr[@]}" on an empty
array is an unbound-var error on bash <4.4. Use ${arr[@]+"${arr[@]}"} so an
empty platform_flag expands to zero args (no spurious empty podman arg),
matching the existing empty-array-guard convention in this file.
The aborted flush wrote no .rc files, so every queued case read back as 127
("expected N got 127" mass failures).
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/lib/exec_target.sh b/test/lib/exec_target.sh
@@ -303,7 +303,10 @@ exec_target_run() {
if ! _exec_target_podman_native "$tag"; then
platform_flag=(--platform "$platform")
fi
- podman run --rm --pull=never "${platform_flag[@]}" --net=none \
+ # ${arr[@]+"${arr[@]}"} (not "${arr[@]}") so an empty platform_flag
+ # expands to zero args under `set -u` on bash 3.2 — macOS /bin/sh —
+ # where a bare "${arr[@]}" on an empty array is an unbound-var error.
+ podman run --rm --pull=never ${platform_flag[@]+"${platform_flag[@]}"} --net=none \
-v "$dir":/work:Z -w /work \
"$image" "./$base" \
>"$out" 2>"$err"
@@ -431,7 +434,7 @@ _exec_target_flush_tag() {
"${EXEC_TARGET_ERRS[$k]}" \
"${EXEC_TARGET_RCS[$k]}"
done
- } | podman run -i --rm --pull=never "${platform_flag[@]}" --net=none \
+ } | podman run -i --rm --pull=never ${platform_flag[@]+"${platform_flag[@]}"} --net=none \
-e EXEC_CASE_TIMEOUT="$case_to" \
-v "$EXEC_TARGET_MOUNT_ROOT":"$EXEC_TARGET_MOUNT_ROOT":Z \
"$image" \