From 104a2891e37a6daf802ef85b82cd53bb03ac311c Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Tue, 10 Nov 2026 13:37:04 -0800 Subject: [PATCH] Stop the tool install when an archive fails to extract set -e ignores a failure on the left of &&, so a failed tar during an update left the old binary in place, marked with the new checksum. Run the extraction and the move as separate commands. Co-Authored-By: Claude Opus 5.5 --- scripts/install-tools.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/install-tools.sh b/scripts/install-tools.sh index 94bb5a5..3235927 100755 --- a/scripts/install-tools.sh +++ b/scripts/install-tools.sh @@ -79,9 +79,17 @@ while read -r tool tool_platform expected url; do exit 1 fi + # One command per line: set -e ignores a failure on the left of &&, which + # would leave the old binary in place under the new checksum. case "$file" in - *.tar.gz) tar -xzf "$file" -C "$tmp" "$tool" && mv "$tmp/$tool" "$bin/$tool" ;; - *.tar.xz) tar -xJf "$file" -C "$tmp" && mv "$tmp"/shellcheck-*/shellcheck "$bin/$tool" ;; + *.tar.gz) + tar -xzf "$file" -C "$tmp" "$tool" + mv "$tmp/$tool" "$bin/$tool" + ;; + *.tar.xz) + tar -xJf "$file" -C "$tmp" + mv "$tmp"/shellcheck-*/shellcheck "$bin/$tool" + ;; *.gz) gunzip -c "$file" >"$bin/$tool" ;; *) mv "$file" "$bin/$tool" ;; esac