From 7ff2c11aeda29ea0e6fd4784312adacbebfc1ccc Mon Sep 17 00:00:00 2001 From: Yury Lebedev Date: Mon, 23 Nov 2026 12:21:37 +0100 Subject: [PATCH] format.sh: verify yamlfmt checksum with shasum when sha256sum is not GNU Recent macOS ships a BSD /sbin/sha256sum that rejects --strict, so the yamlfmt download check failed and ./format.sh exited 1. Only use sha256sum when it is GNU coreutils, and fall back to shasum -a 256 otherwise. Co-Authored-By: Claude Opus 5.5 --- format.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/format.sh b/format.sh index 4fb12b9ec31..4853eeca32a 100755 --- a/format.sh +++ b/format.sh @@ -163,8 +163,9 @@ else fi curl "${curl_retry[@]}" -fLo "$YAMLFMT_BIN.tar.gz" "$YAMLFMT_URL" - # Validate checksum of downloaded archive - if command -v sha256sum > /dev/null; then + # Validate checksum of downloaded archive. Recent macOS ships a BSD + # sha256sum without --strict, so only use sha256sum when it is GNU coreutils. + if command -v sha256sum > /dev/null && sha256sum --version 2>&1 | grep -q GNU; then echo "$YAMLFMT_SHA256 *$YAMLFMT_BIN.tar.gz" | sha256sum --check --strict elif command -v shasum > /dev/null; then echo "$YAMLFMT_SHA256 *$YAMLFMT_BIN.tar.gz" | shasum -a 256 --check --strict