Module Name:    src
Committed By:   rillig
Date:           Sat Jun 11 07:54:25 UTC 2022

Modified Files:
        src/usr.bin/make/unit-tests: varmod-match.exp varmod-match.mk

Log Message:
tests/make: demonstrate another pathological pattern match


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-match.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/varmod-match.exp
diff -u src/usr.bin/make/unit-tests/varmod-match.exp:1.5 src/usr.bin/make/unit-tests/varmod-match.exp:1.6
--- src/usr.bin/make/unit-tests/varmod-match.exp:1.5	Thu Mar  3 20:20:23 2022
+++ src/usr.bin/make/unit-tests/varmod-match.exp	Sat Jun 11 07:54:25 2022
@@ -5,12 +5,13 @@ Comparing "five six seven" != "five six 
 CondParser_Eval: ${NUMBERS:M[^s]*[ex]} != "One Three five"
 Comparing "One Three five" != "One Three five"
 CondParser_Eval: ${:U****************:M****************b}
+CondParser_Eval: ${:U..................................................b:M*?*?*?*?*?a}
 CondParser_Eval: ${:Ua \$ sign:M*$$*} != "\$"
 Comparing "$" != "$"
 CondParser_Eval: ${:Ua \$ sign any-asterisk:M*\$*} != "any-asterisk"
 Comparing "any-asterisk" != "any-asterisk"
-make: "varmod-match.mk" line 146: Unknown modifier "]"
-make: "varmod-match.mk" line 146: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
+make: "varmod-match.mk" line 151: Unknown modifier "]"
+make: "varmod-match.mk" line 151: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-match.mk
diff -u src/usr.bin/make/unit-tests/varmod-match.mk:1.9 src/usr.bin/make/unit-tests/varmod-match.mk:1.10
--- src/usr.bin/make/unit-tests/varmod-match.mk:1.9	Sun May  8 06:51:27 2022
+++ src/usr.bin/make/unit-tests/varmod-match.mk	Sat Jun 11 07:54:25 2022
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-match.mk,v 1.9 2022/05/08 06:51:27 rillig Exp $
+# $NetBSD: varmod-match.mk,v 1.10 2022/06/11 07:54:25 rillig Exp $
 #
 # Tests for the :M variable modifier, which filters words that match the
 # given pattern.
@@ -28,11 +28,16 @@ NUMBERS=	One Two Three Four five six sev
 .  error
 .endif
 
-# Before 2020-06-13, this expression took quite a long time in Str_Match,
-# calling itself 601080390 times for 16 asterisks.
+# Before 2020-06-13, this expression called Str_Match 601,080,390 times.
+# Since 2020-06-13, this expression calls Str_Match 1 time.
 .if ${:U****************:M****************b}
 .endif
 
+# As of 2022-06-11, this expression calls Str_Match 5,242,223 times.
+# Adding another '*?' to the pattern calls Str_Match 41,261,143 times.
+.if ${:U..................................................b:M*?*?*?*?*?a}
+.endif
+
 # To match a dollar sign in a word, double it.
 #
 # This is different from the :S and :C variable modifiers, where a '$'

Reply via email to