makefile: fix glob expansion for macOS
What changed, and why it matters
This commit fixes a build script check that was too strict on macOS. The Makefile check compares a manually maintained list of Bitcoin header files against files found on disk. On Linux, the shell lists files in sorted order, but macOS does not, causing the check to fail even when nothing is wrong. The patch makes the comparison order-independent and prints clearer error messages. It is a build tooling fix with no security relevance.
No security action needed. Treat as a normal build-system portability fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change updates bitcoin/Makefile’s check-bitcoin-makefile target. Previously it compared the literal string expansion of bitcoin/*.h against $(BITCOIN_HEADERS). On macOS, glob expansion order is not lexicographically sorted, so the comparison fails on a clean tree. The new implementation uses GNU make functions: $(filter-out $(BITCOIN_HEADERS), $(wildcard bitcoin/.h)) detects missing headers, and $(filter-out $(wildcard bitcoin/.h), $(BITCOIN_HEADERS)) detects extra/stale entries. It also improves diagnostics by listing the specific missing or non-existent headers. No source code, cryptographic logic, network handling, or privilege boundaries are modified.
Changed components
bitcoin/MakefileInspect captured patch +10 / −1
diff --git a/bitcoin/Makefile b/bitcoin/Makefile
index df2dc04..bf33ee5 100644
--- a/bitcoin/Makefile
+++ b/bitcoin/Makefile
@@ -47,7 +47,16 @@ ALL_C_SOURCES += $(BITCOIN_SRC)
check-makefile: check-bitcoin-makefile
check-bitcoin-makefile:
- @if [ "`echo bitcoin/*.h`" != "$(BITCOIN_HEADERS)" ]; then echo BITCOIN_HEADERS incorrect; exit 1; fi
+ @MISSING="$(filter-out $(BITCOIN_HEADERS), $(wildcard bitcoin/*.h))"; \
+ EXTRA="$(filter-out $(wildcard bitcoin/*.h), $(BITCOIN_HEADERS))"; \
+ if [ -n "$$MISSING" ]; then \
+ echo "BITCOIN_HEADERS missing: $$MISSING"; \
+ exit 1; \
+ fi; \
+ if [ -n "$$EXTRA" ]; then \
+ echo "BITCOIN_HEADERS has non-existent: $$EXTRA"; \
+ exit 1; \
+ fi
check-whitespace: check-whitespace/bitcoin/Makefile
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.