In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/21eede782bed11b0263f9bff02b9ca7b7dfcd6eb?hp=3bbc3d3032212ca88eda829355f4e66179b013ad>
- Log ----------------------------------------------------------------- commit 21eede782bed11b0263f9bff02b9ca7b7dfcd6eb Author: Yves Orton <[email protected]> Date: Sun Jan 29 00:06:23 2012 +0100 Fix bug #109206: ANCH_MBOL with while /.*/g We had a fencepost error when ANCH_MBOL was enabled that meant we did not "see" matches at the end of string. This fixes the problem and adds tests. M regexec.c M t/re/pat.t commit 745b54e4438760197284db88e618b43be29d74ab Author: Yves Orton <[email protected]> Date: Sun Jan 29 00:04:20 2012 +0100 accidentally used my work email for a commit so add it to checkAuthors.pl M Porting/checkAUTHORS.pl ----------------------------------------------------------------------- Summary of changes: Porting/checkAUTHORS.pl | 1 + regexec.c | 4 ++-- t/re/pat.t | 14 +++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Porting/checkAUTHORS.pl b/Porting/checkAUTHORS.pl index a012ae0..43f565d 100755 --- a/Porting/checkAUTHORS.pl +++ b/Porting/checkAUTHORS.pl @@ -387,6 +387,7 @@ davem davem\100fdgroup.com demerphq demerphq\100gmail.com + yves.orton\100de.mci.com + yves.orton\100mciworldcom.de ++ yves.orton\100booking.com + demerphq\100dromedary.booking.com + demerphq\100gemini.(none) + demerphq\100camel.booking.com diff --git a/regexec.c b/regexec.c index 6bd8b20..b84dcbd 100644 --- a/regexec.c +++ b/regexec.c @@ -2245,8 +2245,8 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, register char *stre /*XXX: The s-- is almost definitely wrong here under unicode - demeprhq*/ s--; } - /* We can use a more efficient search as newlines are the same in unicode as they are in latin */ - while (s < end) { + /* We can use a more efficient search as newlines are the same in unicode as they are in latin */ + while (s <= end) { /* note it could be possible to match at the end of the string */ if (*s++ == '\n') { /* don't need PL_utf8skip here */ if (regtry(®info, &s)) goto got_it; diff --git a/t/re/pat.t b/t/re/pat.t index 8ea531c..b4b7ac4 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -21,7 +21,7 @@ BEGIN { require './test.pl'; } -plan tests => 466; # Update this when adding/deleting tests. +plan tests => 469; # Update this when adding/deleting tests. run_tests() unless caller; @@ -1241,6 +1241,18 @@ EOP is "@refs", "Regexp", '/$o$qr/ passes qr ref to cat overload meth'; } + { + my $count=0; + my $str="\n"; + $count++ while $str=~/.*/g; + is $count, 2, 'test that ANCH_MBOL works properly. We should get 2 from $count++ while "\n"=~/.*/g'; + my $class_count= 0; + $class_count++ while $str=~/[^\n]*/g; + is $class_count, $count, 'while "\n"=~/.*/g and while "\n"=~/[^\n]*/g should behave the same'; + my $anch_count= 0; + $anch_count++ while $str=~/^.*/mg; + is $anch_count, 1, 'while "\n"=~/^.*/mg should match only once'; + } } # End of sub run_tests 1; -- Perl5 Master Repository
