Skip to content

Commit

Permalink
Makefile: sort input filenames to SHA256STAMP
Browse files Browse the repository at this point in the history
Make's 'wildcard' function returns matching file paths in an
unpredictable order, thereby causing false mismatches in the produced
SHA256STAMPs from system to system. This commit sorts the file paths
given to 'cat' to make the stamps deterministic.

Changelog-Fixed: The build system no longer spuriously regenerates generated sources due to differences in `readdir`(3) sort order.
  • Loading branch information
whitslack authored and rustyrussell committed Sep 17, 2020
1 parent b4989b9 commit ec29f04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ endif
# Git doesn't maintain timestamps, so we only regen if sources actually changed:
# We place the SHA inside some generated files so we can tell if they need updating.
# Usage: $(call SHA256STAMP_CHANGED)
SHA256STAMP_CHANGED = [ x"`sed -n 's/.*SHA256STAMP://p' $@ 2>/dev/null`" != x"`cat $(filter-out FORCE,$^) | sha256sum | cut -c1-64`" ]
SHA256STAMP_CHANGED = [ x"`sed -n 's/.*SHA256STAMP://p' $@ 2>/dev/null`" != x"`cat $(sort $(filter-out FORCE,$^)) | sha256sum | cut -c1-64`" ]
# Usage: $(call SHA256STAMP,commentprefix)
SHA256STAMP = echo '$(1) SHA256STAMP:'`cat $(filter-out FORCE,$^) | sha256sum | cut -c1-64` >> $@
SHA256STAMP = echo '$(1) SHA256STAMP:'`cat $(sort $(filter-out FORCE,$^)) | sha256sum | cut -c1-64` >> $@

# generate-wire.py --page [header|impl] hdrfilename wirename < csv > file
%_wiregen.h: %_wire.csv $(WIRE_GEN_DEPS)
Expand Down

0 comments on commit ec29f04

Please sign in to comment.