autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exclude M4 with buggy strstr when configuring Autoconf.


From: Ralf Wildenhues
Subject: Re: Exclude M4 with buggy strstr when configuring Autoconf.
Date: Sat, 5 Mar 2011 08:16:41 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

* Eric Blake wrote on Mon, Feb 28, 2011 at 07:06:50PM CET:
> On 02/26/2011 07:50 AM, Ralf Wildenhues wrote:
> >> Autoconf's m4/m4.m4 needs a similar test.
> > 
> > Thanks.  Like this?
> 
> Close, but I'm still thinking about it.
> 
> There's two separate strstr issues:

Thanks for the detailed explanations.  That's going to be painful
though, as basically only (little-tested) 1.4.16 is the only viable
alternative, as there have been security issues fixed after 1.4.10.

> > I should note that it won't exclude a buggy m4 that the user has
> > explicitly set by setting the M4 environment variable.
> 
> Agreed.  It's also possible to detect a broken strstr at runtime as part
> of m4_init, although I'm not sure whether to do that yet.  It's even
> technically feasible to replace a broken m4_index() with m4_regex() (by
> escaping the search string and doing the search via regular expressions
> instead), but certainly inefficient, and I'm not sure it's worth the
> hassle to try that.

It would be sad to see further runtime slowdown due to bugs in tools,
IMVHO.

Updated patch below.  OK?

Thanks,
Ralf

2011-03-05  Ralf Wildenhues  <address@hidden>
            Eric Blake  <address@hidden>

        Exclude M4 with buggy strstr when configuring Autoconf.
        * m4/m4.m4 (AC_PROG_GNU_M4): When searching PATH, do not accept
        an m4 that has either the gnulib strstr bug, or the glibc/gnulib
        strstr bug.

diff --git a/m4/m4.m4 b/m4/m4.m4
index a11fe0d..e37ff4e 100644
--- a/m4/m4.m4
+++ b/m4/m4.m4
@@ -1,4 +1,4 @@
-# m4.m4 serial 11
+# m4.m4 serial 12
 
 # Copyright (C) 2000, 2006-2011 Free Software Foundation, Inc.
 
@@ -25,15 +25,24 @@ AS_UNSET([POSIXLY_CORRECT])
 AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4 gnum4],
       [dnl Creative quoting here to avoid raw dnl and ifdef in configure.
       # Root out GNU M4 1.4.5, as well as non-GNU m4 that ignore -t, -F.
+      # Root out GNU M4 1.4.13 and 1.4.14 with buggy replacement strstr.
+      # Root out Glibc 2.9 - 2.12 and GNU M4 1.4.11 - 1.4.15 with buggy
+      # strstr.
       ac_snippet=change'quote(<,>)in''dir(<if''def>,mac,bug)'
       ac_snippet=${ac_snippet}pat'subst(a,\(b\)\|\(a\),\1)d'nl
+      
ac_snippet=${ac_snippet}${as_nl}if'else(in''dex(..wi.d.,.d.),-1,strstr-bug)'
+      ac_snippet=${ac_snippet}${as_nl}if'else(in''dex(dnl
+;:11-:12-:12-:12-:12-:12-:12-:12-:12.:12.:12.:12.:12.:12.:12.:12.:12-,dnl
+:12-:12-:12-:12-:12-:12-:12-:12-),-1,,strstr-bug2)'
       test -z "`$ac_path_M4 -F conftest.m4f </dev/null 2>&1`" \
       && test -z "`AS_ECHO([$ac_snippet]) | $ac_path_M4 --trace=mac 2>&1`" \
       && test -f conftest.m4f \
       && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:
       rm -f conftest.m4f],
       [AC_MSG_ERROR([no acceptable m4 could be found in \$PATH.
-GNU M4 1.4.6 or later is required; 1.4.14 is recommended])])])
+GNU M4 1.4.6 or later is required; 1.4.16 or newer is recommended.
+GNU M4 1.4.14 and 1.4.15 use a buggy replacement strstr on some systems.
+Glibc 2.9 - 2.12 and GNU M4 1.4.11 - 1.4.15 have another strstr bug])])])
   M4=$ac_cv_path_M4
   AC_CACHE_CHECK([whether $ac_cv_path_M4 accepts --gnu],
     [ac_cv_prog_gnu_m4_gnu],



reply via email to

[Prev in Thread] Current Thread [Next in Thread]