develooper Front page | perl.perl5.porters | Postings from November 2010

Who fixed this 5.10.0 bug?

Thread Next
Tom Christiansen
November 25, 2010 12:07
Who fixed this 5.10.0 bug?
Message ID:
19 out of the 20 different versions of Perl I tested 
are free of the following bug, but one is not: 5.10.0.

I've stumbled across a version-dependent bug as part of a test suite that
runs 1,478,376 matches related to regex \b \B boundaries in all possible
configurations -- and I do mean all. :)  The bug that appears *only* in
the 5.10.0 release.  It does not occur in any of the following releases,
which were tested on a half-dozen different platforms:

    5.6.0   5.6.1
    5.8.0   5.8.1   5.8.2   5.8.4   5.8.6   5.8.7   5.8.8   5.8.9
    5.11.0  5.11.3  5.11.3  5.11.4
    5.12.0  5.12.2
    5.13.0  5.13.6(blead)

No matter the platform, the bug occurs in 5.10.0 only.

I checked the 5.10.1 perldelta's "selected bug fixes" section,
but didn't see anything that would seems likely to be it.

If there is *not* yet a regression test for this bug, I
strongly suggest that there be one.

This 5.10.0-only bug occured in detecting a boundary or a nonboundary
when that boundary or nonboundary was next to a string edge and there
was a nonword character on the other side **AND** this test occurs in
either branch of of the (?(IF)THEN|ELSE) construct.

For example, here are the simplest cases where it occurs:

        Test [3, 0]: doesn't "=a" =~ /\b=/
        Test [3, 1]: matches "=a" =~ /(?(?=\w)(?<!\w)|(?<=\w))=/
        Test [3, 2]: doesn't "=a" =~ /(?<=\w)=/

        Test [7, 0]: doesn't "a=" =~ /\B=/
        Test [7, 1]: matches "a=" =~ /(?(?=\w)(?<=\w)|(?<!\w))=/
        Test [7, 2]: doesn't "a=" =~ /(?<!\w)=/

        Test [1, 0]: doesn't "a=" =~ /=\b/
        Test [1, 1]: matches "a=" =~ /=(?(?<=\w)(?!\w)|(?=\w))/
        Test [1, 2]: doesn't "a=" =~ /=(?=\w)/

        Test [5, 0]: doesn't "=a" =~ /=\B/
        Test [5, 1]: matches "=a" =~ /=(?(?<=\w)(?=\w)|(?!\w))/
        Test [5, 2]: doesn't "=a" =~ /=(?!\w)/

Each set of three is intended to be an equivalent test of boundaries for
that particular string.  In all failing cases, the conditional gets a
different answer than the other two, erroneously suceeding where they fail.
Those are all in the ELSE branch, but it still occurs when THEN and ELSE
clauses are swapped.

The bug existed only in the 5.10.0 release, occurring neither before nor
after.  Does this ring any bells?  Is there a regression test for it?

Thanks, and Happy Thanksgiving!  Time to cook.


PS: I enclose two files: the test suite itself, plus another script to
    run that suite against all installed versions of Perl.

    -rw-r--r--  1 tchrist  wheel  10419 Nov 25 12:59 bordercrossing
    -rw-r--r--  1 tchrist  wheel   1600 Nov 25 13:00 mux-borders

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About