develooper Front page | perl.perl5.porters | Postings from August 2008

RE: [perl #35877] Strange regex failure?

Thread Previous | Thread Next
From:
Bram
Date:
August 3, 2008 07:35
Subject:
RE: [perl #35877] Strange regex failure?
Message ID:
20080803163529.bd73ojeg2s4ow0w4@horde.wizbit.be
Citeren Steve Hay <SteveHay@planit.com>:

> Bram via RT wrote:
>> On Fri Nov 16 06:46:06 2007, stmpeters wrote:
>>> On Thu May 19 03:49:55 2005, shay wrote:
>>>> This is a bug report for perl from steve.hay@uk.radan.com,
>>>> generated with the help of perlbug 1.35 running under perl v5.8.6.
>>>>
>>>> I believe that the following program should print "OK" 5 times
>>>> over,    but it prints "NOT OK" from the first line.
>>>>
>>>> print qq[>10\n] =~ />\d+$ \n/ix  ? "OK\n" : "NOT OK\n";
>>>> print qq[>1\n]  =~ />\d+$ \n/ix  ? "OK\n" : "NOT OK\n";
>>>> print qq[>10\n] =~ /\d+$ \n/ix   ? "OK\n" : "NOT OK\n";
>>>> print qq[>10\n] =~ />\d\d$ \n/ix ? "OK\n" : "NOT OK\n";
>>>> print qq[>10\n] =~ />\d+$ \n/x   ? "OK\n" : "NOT OK\n";
>>>>
>>>> I get the same behaviour with 5.6.0 through to 5.8.6 and bleadperl,
>>>> all on Windows XP.
>>>>
>>>
>>> I just ran this with a recent blead and got...
>>>
>>> [steve@sulu ~]$ /tmp/bleadperl/bin/perl5.10.0 rt_35877.t
>>> OK
>>> OK
>>> OK
>>> OK
>>> OK
>>>
>>> Can you a few other people double check just to make sure this isn't
>>> a heisenbug?
>>>
>>> Thanks,
>>>
>>> Steve Peters
>>
>> I'm not sure if tests for this were added so a patch with the tests of
>> the report is attached.
>
> Are my eyes just glazing over, or have you got this slightly different
> to the original bug report?
>
> Your patch has
>
> />\d+$ \n/ix   >10\n
> /\d+$ \n/ix    >1\n
> /\d+$ \n/ix    >10\n
> />\d\d$ \n/ix  >10\n
> />\d+$ \n/x    >10\n
>
> but the original bug report had
>
> />\d+$ \n/ix   >10\n
> />\d+$ \n/ix   >1\n
> /\d+$ \n/ix    >10\n
> />\d\d$ \n/ix  >10\n
> />\d+$ \n/x    >10\n
>
> You seem to have missed a '>' from the second test.
>
> It actually fails either way with maint, and works either way with
> blead, so it probably doesn't matter. I just wondered if there was some
> significance to your change?

The change was unintended...

New patch attached.

In the meantime I've also done a binary search which says that
the problem was fixed with Change 29441.

test_35877.pl
#!/usr/bin/perl

print qq[>10\n] =~ />\d+$ \n/ix ? "ok\n" : "not ok\n";
./perl-p-5.9.4\@29440/miniperl test_35877.pl
not ok

./perl-p-5.9.4\@29441/miniperl test_35877.pl
ok

http://public.activestate.com/cgi-bin/perlbrowse/p/29441
Change 29441 by rgs@marais on 2006/12/03 18:37:15

	Subject: Re: [perl #41010] (?(COND)) in pattern matching not working properly
	From: demerphq <demerphq@gmail.com>
	Date: Thu, 30 Nov 2006 01:12:25 +0100
	Message-ID: <9b18b3110611291612i137803f4lab2739e3d9af40f7@mail.gmail.com>

(Your mail got lost in my inbox... else I would have replied sooner)



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About