From 3357cf912e6c4baafd026dae699d9175ddea400c Mon Sep 17 00:00:00 2001 From: Kousik Kumar Date: Fri, 31 Mar 2023 09:57:01 +0000 Subject: [PATCH] Make sort as part of the inner command It turns out, in Cog workspaces, the order of files returned by "find" command is inherently non-deterministic (they use an absl::HashMap which intentionally tries to NOT guarantee sort order). This results in varying order for the inner variable, which actually causes invalidation and regeneration of the build graph (I'm guessing when "y" changes in $(sort $(y)), it causes an invalidation in Make). Hence made the sort a part of the inner command itself. Tested: Ran the build with Cog and ensured graph wasn't regenerated across reruns. Bug: b/276397558 Change-Id: Ie772572048785793067f74c08ac3994ef6cbaa43 --- core/product_config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/product_config.mk b/core/product_config.mk index 7055a1e958..de97c157d0 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -74,7 +74,7 @@ endif ########################################################### define find-copy-subdir-files -$(sort $(shell find $(2) -name "$(1)" -type f | $(SED_EXTENDED) "s:($(2)/?(.*)):\\1\\:$(3)/\\2:" | sed "s://:/:g")) +$(shell find $(2) -name "$(1)" -type f | $(SED_EXTENDED) "s:($(2)/?(.*)):\\1\\:$(3)/\\2:" | sed "s://:/:g" | sort) endef #