From 44c9cff66ee377079483522d57f692ac8b429d3b Mon Sep 17 00:00:00 2001 From: Chris Butler Date: Fri, 29 May 2026 09:50:07 +0900 Subject: [PATCH] fix: handle empty arrays with set -u in pattern.sh On macOS with podman machine, PKI_HOST_MOUNT_ARGS and EXTRA_ARGS_ARRAY can be empty arrays. When using set -u (nounset), bash throws "unbound variable" errors when expanding empty arrays with [@]. Use conditional expansion "${array[@]+"${array[@]}"}" which expands to nothing if the array is empty, avoiding the unbound variable error. This fixes: ./pattern.sh: line 93: PKI_HOST_MOUNT_ARGS[@]: unbound variable Co-Authored-By: Claude Sonnet 4.5 --- pattern.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pattern.sh b/pattern.sh index e7f16e5c..71c50023 100755 --- a/pattern.sh +++ b/pattern.sh @@ -114,12 +114,12 @@ podman run -it --rm --pull=newer \ -e TOKEN_SECRET \ -e UUID_FILE \ -e VALUES_SECRET \ - "${PKI_HOST_MOUNT_ARGS[@]}" \ + "${PKI_HOST_MOUNT_ARGS[@]+"${PKI_HOST_MOUNT_ARGS[@]}"}" \ -v "$(pwd -P)":"$(pwd -P)" \ -v "${HOME}":"${HOME}" \ -v "${HOME}":/pattern-home \ "${PODMAN_ARGS[@]}" \ - "${EXTRA_ARGS_ARRAY[@]}" \ + "${EXTRA_ARGS_ARRAY[@]+"${EXTRA_ARGS_ARRAY[@]}"}" \ -w "$(pwd -P)" \ "$PATTERN_UTILITY_CONTAINER" \ "$@"