8071651: infinite build loops in 9-dev windows platform on Jan 26
authorerikj
Wed, 28 Jan 2015 14:04:05 +0100
changeset 28607 380f123263d8
parent 28606 e4a5774f2ddd
child 28608 999f0b83f071
8071651: infinite build loops in 9-dev windows platform on Jan 26 Reviewed-by: alanb, ihse
make/common/MakeBase.gmk
test/make/TestMakeBase.gmk
--- a/make/common/MakeBase.gmk	Tue Jan 27 10:11:22 2015 -0800
+++ b/make/common/MakeBase.gmk	Wed Jan 28 14:04:05 2015 +0100
@@ -445,7 +445,9 @@
 uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
 
 # String equals
-equals = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
+equals = \
+    $(and $(findstring $(strip $1),$(strip $2)),\
+        $(findstring $(strip $2),$(strip $1)))
 
 ifneq ($(DISABLE_CACHE_FIND), true)
   ################################################################################
@@ -606,8 +608,8 @@
             $(call ReadFile, $(call DependOnVariableFileName, $1, $2)))),,\
       $(call MakeDir, $(dir $(call DependOnVariableFileName, $1, $2))) \
       $(if $(findstring $(LOG_LEVEL), trace), \
-          $(info Variable $1: $(strip $($1))) \
-          $(info File: $(call ReadFile, $(call DependOnVariableFileName, $1, $2)))) \
+          $(info Variable $1: >$(strip $($1))<) \
+          $(info File: >$(call ReadFile, $(call DependOnVariableFileName, $1, $2))<)) \
       $(call WriteFile, $($1), $(call DependOnVariableFileName, $1, $2))) \
     $(call DependOnVariableFileName, $1, $2))
 
--- a/test/make/TestMakeBase.gmk	Tue Jan 27 10:11:22 2015 -0800
+++ b/test/make/TestMakeBase.gmk	Wed Jan 28 14:04:05 2015 +0100
@@ -63,6 +63,20 @@
 TEST_TARGETS += $(ESCAPE_DOLLAR_DIR)/_escape_dollar
 
 ################################################################################
+# Test Equals
+
+EQUALS_VALUE1 := value1$(SPACE)
+EQUALS_VALUE2 := value2
+
+ifneq ($(call equals, $(EQUALS_VALUE1), $(EQUALS_VALUE2)), )
+  $(error The strings >$(EQUALS_VALUE1)< and >$(EQUALS_VALUE2)< are equal)
+endif
+
+ifeq ($(call equals, $(EQUALS_VALUE1), $(EQUALS_VALUE1)), )
+  $(error The strings >$(EQUALS_VALUE1)< and >$(EQUALS_VALUE1)< are not equal)
+endif
+
+################################################################################
 # Test ShellQuote
 
 SHELL_QUOTE_VALUE := foo '""' "''" bar