diff --git a/cluster/clientbin.sh b/cluster/clientbin.sh index dc4f673f17c..82d6d68263d 100755 --- a/cluster/clientbin.sh +++ b/cluster/clientbin.sh @@ -65,12 +65,6 @@ case "$(uname -m)" in ;; esac -# Get the absolute path of the directory component of a file, i.e. the -# absolute path of the dirname of $1. -get_absolute_dirname() { - echo "$(cd "$(dirname "$1")" && pwd)" -} - function get_bin() { bin="${1:-}" srcdir="${2:-}" @@ -93,9 +87,12 @@ function get_bin() { # The bazel go rules place binaries in subtrees like # "bazel-bin/source/path/linux_amd64_pure_stripped/binaryname", so make sure # the platform name is matched in the path. - locations+=($(find "${KUBE_ROOT}/bazel-bin/${srcdir}" -type f -executable \ - -path "*/${host_os}_${host_arch}*/${bin}" 2>/dev/null || true) ) - echo $( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 ) + while IFS=$'\n' read -r line; do + locations+=( "${line}" ) + done < <(find "${KUBE_ROOT}/bazel-bin/${srcdir}" -type f -executable \ + -path "*/${host_os}_${host_arch}*/${bin}" 2>/dev/null || true) + + (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 } function print_error() { diff --git a/hack/.shellcheck_failures b/hack/.shellcheck_failures index 55ef10e6d69..90ac41b9230 100644 --- a/hack/.shellcheck_failures +++ b/hack/.shellcheck_failures @@ -1,7 +1,6 @@ ./build/lib/release.sh ./cluster/addons/addon-manager/kube-addons.sh ./cluster/addons/fluentd-elasticsearch/es-image/run.sh -./cluster/clientbin.sh ./cluster/common.sh ./cluster/gce/config-common.sh ./cluster/gce/config-default.sh