From aeb325e6e832467c38c4baff1ee68c7726ad9f7c Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Thu, 27 Aug 2015 21:07:43 +0100 Subject: PATCH: [perl 125825] {n}+ possessive quantifier broken I was unaware of this construct when I wrote the commit that broke it, and there were no tests for it. Now there are. (cherry picked from commit 9a7bb2f73a8a1b561890191974201d576371e7f9) --- pod/perldelta.pod | 7 +++++++ regcomp.c | 4 +--- t/re/re_tests | 2 ++ t/re/reg_mesg.t | 1 - 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 14da137516..4c8a7aaab5 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -232,6 +232,13 @@ to mean C. This has been fixed. A crash with C<< %::=(); J->${\"::"} >> has been fixed. L<[perl #125541]|https://rt.perl.org/Ticket/Display.html?id=125541> +=item * + +Regular expression possesive quantifier v5.20 regression now fixed. +CIC<{>I,IC<}+>C is supposed to behave identically +to C>IC<{>I,IC<})/>. Since v5.20, this didn't +work if I and I were equal. [perl #125825] + =back =head1 Acknowledgements diff --git a/regcomp.c b/regcomp.c index 84af011340..606b3373b3 100644 --- a/regcomp.c +++ b/regcomp.c @@ -10455,9 +10455,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) ret = reg_node(pRExC_state, OPFAIL); return ret; } - else if (min == max - && RExC_parse < RExC_end - && (*RExC_parse == '?' || *RExC_parse == '+')) + else if (min == max && RExC_parse < RExC_end && *RExC_parse == '?') { if (SIZE_ONLY) { ckWARN2reg(RExC_parse + 1, diff --git a/t/re/re_tests b/t/re/re_tests index d883add8f0..11c4125070 100644 --- a/t/re/re_tests +++ b/t/re/re_tests @@ -1887,5 +1887,7 @@ A+(*PRUNE)BC(?{}) AAABC y $& AAABC /(alias|status)es$/i Statuses y $1 Status # [perl #121778] (.)(?{$~=$^N}) \x{100} y $~ \x{100} # [perl #123135] +/(a+){1}+a/ aaa n - - # [perl #125825] + # Keep these lines at the end of the file # vim: softtabstop=0 noexpandtab diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t index 55eda189da..77f7aa10d4 100644 --- a/t/re/reg_mesg.t +++ b/t/re/reg_mesg.t @@ -382,7 +382,6 @@ my @warning = ( 'Useless (?c) - use /gc modifier {#} m/(?ogc{#})/', ], '/a{1,1}?/' => 'Useless use of greediness modifier \'?\' {#} m/a{1,1}?{#}/', - '/b{3} +/x' => 'Useless use of greediness modifier \'+\' {#} m/b{3} +{#}/', ); my @warnings_utf8 = mark_as_utf8( -- cgit v1.2.1