From 15211966deb52d4cae425c655177a815a88d3fc0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Sun, 19 Apr 2026 19:36:03 -0700
Subject: [PATCH] maint.mk: fix sc_Wundef_boolean race with parallel
 syntax-check

With highly parallel "make syntax-check", sc_Wundef_boolean's
in_files='config.h' was matched as an unanchored, unescaped regex
by "find | grep -E", so the '.' matched any character and the lack
of anchoring matched anywhere in a path.  This made it match the
.sc-start-sc_*config_h* marker files created by parallel rules.
Symptom: I saw see these go by:
  grep: ./.sc-start-sc_require_config_h_first: No such file or directory
  grep: ./.sc-start-sc_prohibit_have_config_h: No such file or directory
  grep: ./.sc-start-sc_require_config_h: No such file or directory
* top/maint.mk (sc_Wundef_boolean): Use '(^|/)config\.h$' rather
than bare 'config.h' as the in_files ERE.
---
 ChangeLog    | 15 +++++++++++++++
 top/maint.mk |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 1bfea74667..cbadb6f687 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-04-19  Jim Meyering  <meyering@fb.com>
+
+	maint.mk: fix sc_Wundef_boolean race with parallel syntax-check
+	With highly parallel "make syntax-check", sc_Wundef_boolean's
+	in_files='config.h' was matched as an unanchored, unescaped regex
+	by "find | grep -E", so the '.' matched any character and the lack
+	of anchoring matched anywhere in a path.  This made it match the
+	.sc-start-sc_*config_h* marker files created by parallel rules.
+	Symptom: I saw see these go by:
+	  grep: ./.sc-start-sc_require_config_h_first: No such file or directory
+	  grep: ./.sc-start-sc_prohibit_have_config_h: No such file or directory
+	  grep: ./.sc-start-sc_require_config_h: No such file or directory
+	* top/maint.mk (sc_Wundef_boolean): Use '(^|/)config\.h$' rather
+	than bare 'config.h' as the in_files ERE.
+
 2026-04-19  Paul Eggert  <eggert@cs.ucla.edu>

 	regex tests: pacify -Wshadow
diff --git a/top/maint.mk b/top/maint.mk
index a37b8b3d6c..177a1833d4 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -1475,7 +1475,7 @@ sc_prohibit_reversed_compare_failure:
 # and the 'bool' module supports it.
 sc_Wundef_boolean:
 	@prohibit='^#define.*(yes|no)$$'				\
-	in_files='$(CONFIG_INCLUDE)'					\
+	in_files='(^|/)$(subst .,\.,$(CONFIG_INCLUDE))$$'		\
 	halt='Use 0/1 or false/true for macro values'			\
 	  $(_sc_search_regexp)

-- 
2.52.0

