From 29ba3a2f6afa5bc2ab3fd1f11a855283149f7226 Mon Sep 17 00:00:00 2001 From: Yu-Cheng Chen Date: Tue, 28 Jan 2025 22:17:53 +0800 Subject: [PATCH] Replace sha1sum with gsha1sum on macOS Recent macOS updates introduced /sbin/sha1sum, which is not GNU's sha1sum and is incompatible with its implementation. This causes the sha1sum test in make artifact to always pass because the test currently relies on detecting the string "FAILED" in the stderr output. Apple's sha1sum does not support the -c (checksum verification) option, making it unsuitable for verifying artifact integrity. --- mk/common.mk | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mk/common.mk b/mk/common.mk index ef16146b5..82c11c4e9 100644 --- a/mk/common.mk +++ b/mk/common.mk @@ -41,8 +41,14 @@ NC = \033[0m notice = $(PRINTF) "$(PASS_COLOR)$(strip $1)$(NO_COLOR)\n" # File utilities -SHA1SUM = sha1sum -SHA1SUM := $(shell which $(SHA1SUM)) +ifeq ($(UNAME_S),Darwin) + SHA1SUM = gsha1sum + SHA1SUM := $(shell which $(SHA1SUM)) +else + SHA1SUM = sha1sum + SHA1SUM := $(shell which $(SHA1SUM)) +endif + ifndef SHA1SUM SHA1SUM = shasum SHA1SUM := $(shell which $(SHA1SUM))