RFR: JDK-8189376 Unsorted $(wildcard) causes instable module-deps.gmk
Magnus Ihse Bursie
magnus.ihse.bursie at oracle.com
Wed Oct 25 08:09:13 UTC 2017
We have implicitly assumed that subsequent calls to $(wildcard) will
return the same (sorted) order of files during a single build operation.
This is not guaranteed since GNU make 3.82, but will be the case in
practice on most systems due the the filesystem being used.
It turned out that if the order was different, FindAllModuleInfos
returned different strings which in turn caused module-deps.gmk to be
re-generated at any time during the build, causing race conditions.
The bug analysis and patch is contributed by Martin Buchholz.
diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk
@@ -249,10 +249,10 @@
# Param 1 - Module to find for, set to * for finding all
FindAllModuleInfos = \
- $(wildcard \
+ $(sort $(wildcard \
$(foreach sub, $(SRC_SUBDIRS), \
$(patsubst %,%/$(strip $1)/$(sub)/module-info.java,
- $(patsubst %,%/$(strip $1)/module-info.java,
+ $(patsubst %,%/$(strip $1)/module-info.java,
# Find module-info.java files in the specific source dir
# Param 1 - Src dir to find module-info.java files in
More information about the build-dev