Skip to content

Commit

Permalink
Ensure Compatibility with BSD sha1sum
Browse files Browse the repository at this point in the history
BSD and GNU implementations have slightly different behavior, the
former implementation is used in macOS, FreeBSD and similar systems.

While both implementations behave identically with the -c - argument
when the file exists, they differ when the file does not exist. This
commit adds an 'ls' command to address this difference, ensuring
consistent behavior across platforms.
  • Loading branch information
otteryc committed Jan 28, 2025
1 parent 418a9e6 commit f983718
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mk/external.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ define verify
| sort \
| $(SHA1SUM) \
| cut -f 1 -d ' ' > $(SHA1_FILE2) && cmp $(SHA1_FILE1) $(SHA1_FILE2))), \
($(eval VERIFIER := echo "$(strip $(1)) $(strip $(2))" | $(SHA1SUM) -c)) \
($(eval VERIFIER := (ls $(2) >/dev/null 2>&1 || echo FAILED) && echo "$(strip $(1)) $(strip $(2))" | $(SHA1SUM) -c -)) \
))
$(eval _ := $(shell $(VERIFIER) 2>&1))
$(eval _ := \
Expand Down

0 comments on commit f983718

Please sign in to comment.