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: Eric Blake
Subject: Re: Exclude M4 with buggy strstr when configuring Autoconf.
Date: Mon, 28 Feb 2011 11:06:50 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

[dropping bug-autoconf]

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:

index(..wi.d., .d.) mistakenly returns -1 on just m4 1.4.15, if the
gnulib strstr was in use.  This one has been seen to affect configure
scripts in the wild (witness the gcc bug report that sparked this thread).

index(;:11-:12-:12-:12-:12-:12-:12-:12-:12.:12.:12.:12.:12.:12.:12.:12.:12-,
:12-:12-:12-:12-:12-:12-:12-:12-) mistakenly returns a positive value on
m4 1.4.11 through 1.4.15, if the gnulib strstr was in use, or if the
buggy glibc 2.9 through 2.12 strstr was in use.  To date, no one has
reported a broken configure script due to this issue, but as long as
we're rejecting broken strstr, we might as well reject both sets of
broken behavior.

Platforms affected by the broken behaviors:

Most non-glibc platforms have a quadratic strstr - therefore, they will
pick up the gnulib replacement, which in turn means they are affected on
m4 1.4.11 through 1.4.15 for the false negative, and 1.4.15 for the
false positive.  The upcoming m4 1.4.16 release will still use the
gnulib replacement, but no longer have bugs.

Glibc 2.9 through 2.12 has a broken strstr (although on 2.11+, the
brokenness is only present if you are on a machine that lacks SSE4.2
support), but this was not detected at configure time until post
m4-1.4.15; therefore, they will be affected in m4 1.4.11 through 1.4.15
for the false negative, but not trigger the false positive.  The
upcoming m4 1.4.16 release will detect this bug and use the gnulib
replacement.

Glibc 2.11 - current [2.13] has a quadratic strstr, but only if on a
machine with SSE4.2 support.  The upcoming m4 1.4.16 release will detect
this bug and use the gnulib replacement (but this doesn't help people
that configure on a non-SSE4.2 then run the binary on SSE4.2).  I
suspect that this is the scenario that Ralf bisected (as it was the
post-1.4.15 patch that caused the gnulib strstr to be pulled in to his
builds, at the point where gnulib strstr still had the false positive).

> 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 seems like a bug in AC_MSG_ERROR that I cannot use a comma in
> the message, with the current amount of quoting.

Hmm, that seems like an independent issue; I'll have to add that to my
list of things to look at separately from this.

> @@ -25,15 +25,18 @@ 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.
>        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)'

So, given my above analysis, the comment doesn't match the test - this
test only roots out a bug present in just m4 1.4.15.

>        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.13 or 1.4.16+ are recommended.
> +GNU M4 1.4.14 and 1.4.15 use a buggy strstr on some systems])])])

And we should probably list 1.4.11 through 1.4.15 as the full bounds of
m4 builds affected by at least one strstr bug on at least one system.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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