From 912567e9675e935d6368f5d527da397839253f55 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Tue, 27 Jan 2026 16:00:08 -0500 Subject: [PATCH] autoreconf: require word boundaries when grepping for macros (#111271) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit autoreconf’s first pass over configure.ac is effectively a grep operation for a number of macros that almost always appear directly in that file, if they’re going to appear at all. All but one of the regular expressions made no attempt to check for word boundaries, and the one that did was doing it incorrectly (using ^ rather than \b), leading to issue #111271. Fix all the regexps to surround each identifier with \b…\b and not to use ^. Reported by Kip, originally as gettext bug #52424. * bin/autoreconf.in (autoreconf_current_directory): In the first pass, require each of the macros we look for to be a complete word. --- bin/autoreconf.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/autoreconf.in b/bin/autoreconf.in index 1dc38c840..4d08e5301 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -450,17 +450,17 @@ sub autoreconf_current_directory ($) while ($_ = $configure_ac_file->getline) { s/#.*//; - s/dnl.*//; - $uses_autoconf = 1 if /AC_INIT/; - $uses_liblink = 1 if /AC_LIB_HAVE_LINKFLAGS/; - $uses_liblink = 1 if /AC_LIB_LINKFLAGS/; - $uses_liblink = 1 if /AC_LIB_LINKFLAGS_FROM_LIBS/; - $uses_iconv = 1 if /AM_ICONV/; + s/\bdnl\b.*//; + $uses_autoconf = 1 if /\bAC_INIT\b/; + $uses_liblink = 1 if /\bAC_LIB_HAVE_LINKFLAGS\b/; + $uses_liblink = 1 if /\bAC_LIB_LINKFLAGS\b/; + $uses_liblink = 1 if /\bAC_LIB_LINKFLAGS_FROM_LIBS\b/; + $uses_iconv = 1 if /\bAM_ICONV\b/; # See below for why we look for gettext here. - $uses_gettext = 1 if /AM_GNU_GETTEXT/; - $uses_gettext = 1 if /AM_PO_SUBDIRS/; + $uses_gettext = 1 if /\bAM_GNU_GETTEXT\b/; + $uses_gettext = 1 if /\bAM_PO_SUBDIRS\b/; # Older autopoint versions fail if this macro is not present. - $uses_gettextversion = 1 if /^AM_GNU_GETTEXT_(?:REQUIRE_)?VERSION/; + $uses_gettextversion = 1 if /\bAM_GNU_GETTEXT_(?:REQUIRE_)?VERSION\b/; } if (!$uses_autoconf) { -- 2.47.3