From 36e0268aa67bb757d7b9b39cbe1e7f89332f6746 Mon Sep 17 00:00:00 2001 From: John Beckett Date: Mon, 21 Sep 2020 13:34:17 +0100 Subject: [PATCH] build: find_md5 list with mod time and sorted It was observed that the MD5 would not change after source files had been modified, looking deeper into the build process it was discovered that find_md5 build function makes a list of the files being built and then passes the list to a summing utility on stdin. The resultant MD5 is of the file list, not the contents of the files. The MD5 would change if the ordering of the list changed, or items were removed or deleted. The proposed fix is to add the modification time after the filename and then sort the list to prevent find returning files in a different order falsely re-triggering a rebuild. The MD5 will now change when a file is modified or files are added/removed from the list. Using 'T@' to show time in epoch for timezone independent behaviour. Signed-off-by: John Beckett --- include/depends.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/depends.mk b/include/depends.mk index 3df51adae3..ace7139000 100644 --- a/include/depends.mk +++ b/include/depends.mk @@ -13,7 +13,7 @@ DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*" -find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | mkhash md5 +find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -printf "%p%T@\n" | sort | mkhash md5 define rdep .PRECIOUS: $(2) -- 2.30.2