From ecb6d13253194b16bd47cd4e3defc49d80be4505 Mon Sep 17 00:00:00 2001 From: Ismo Puustinen Date: Tue, 5 Mar 2019 18:34:10 +0200 Subject: [PATCH] hack/lib/util.sh: fix empty array expansion with bash 3. --- hack/lib/util.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index c820206d8ee..31ce9fc4a72 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -649,7 +649,9 @@ EOF # Determines if docker can be run, failures may simply require that the user be added to the docker group. function kube::util::ensure_docker_daemon_connectivity { IFS=" " read -ra DOCKER <<< "${DOCKER_OPTS}" - DOCKER=(docker "${DOCKER[@]}") + # Expand ${DOCKER[@]} only if it's not unset. This is to work around + # Bash 3 issue with unbound variable. + DOCKER=(docker ${DOCKER[@]:+"${DOCKER[@]}"}) if ! "${DOCKER[@]}" info > /dev/null 2>&1 ; then cat <<'EOF' >&2 Can't connect to 'docker' daemon. please fix and retry.