New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perl regular expression bug in v5.18 #14775
Comments
From @mschoutCreated by @mschoutThis is a bug report for perl from mschout@gkg.net, ----------------------------------------------------------------- Here is the regular expression substitution: s|^(?:\s*h)?/||i When given the string 'h//w/b', this should strip off the "h/" at the NOTE: This is a reduced down version from the original that triggered this bug s|^(?:\s*https?:)?//[^/]+||i Under perl v5.18, this does not work: perl 5.18.4: $ perl -E '$x = "h//w/b"; $x =~ s|^(?:\s*h)?/||i; say $x' h//w/b However, this works perfectly on v5.16.3, and also on v5.20.0: perl 5.16.3: /w/b perl 5.20.0: $ perl -E '$x = "h//w/b"; $x =~ s|^(?:\s*h)?/||i; say $x' /w/b Curiously, the following changes to the regex yield the correct results: - remove the "\s*": s|^(?:h)?/||i -> works correctly in 5.18 A git bisect shows that this broke in the following commit on v5.17: b25a103 is the first bad commit regcomp.c: Clean up ANYOF_CLASS handling. :100644 100644 eee952f376f066c6757208aae350b70dfb9fc9e3 bf8d7e0bab1079f84d490f4cc93e6737516ef47d M regcomp.c And reverse bisecting for when this bug was fixed in 5.19, I found that this bug went away with the following commit: commit cdd87c1 Teach regex optimizer to handle above-Latin1 :100644 100644 ec203f9c1f3ea42c65324e632c746042c32954f1 3dd62f946eedd99f87489fecfeb1acd86e2d250b M embed.fnc I realize fully that 5.18 is officially "End of life", but this is a rather Perl Info
|
From @cowensIt looks like it can be further reduced to: perl -E 'say map "<$_>", "a/" =~ m{(b*a)?/}i' The following all fail perl -E 'say map "<$_>", "a%" =~ m{(\s*a)?%}i' The following (as far as I can see as a user) semantically equivalent perl -E 'say map "<$_>", "ac" =~ m{(b*a)?c}i' It is interesting to note that the regex succeeds, but matches nothing. perl -E 'say map "<$_>", "ba/" =~ m{(b*a)?/}i' On Sat, Jun 27, 2015 at 2:20 AM Michael Schout <perlbug-followup@perl.org>
|
The RT System itself - Status changed from 'new' to 'open' |
From @khwilliamsonI'm reluctant to try to fix this bug in 5.18.5. The commit that fixed it in 5.20 had 937 changed lines in regcomp.c It would be very dangerous to try to include parts of that commit. The commit that broke it is quite small, but reverting that might break something else. |
From @khwilliamsonThis ticket has been overtaken by events. It asked that a regression that was fixed in 5.20 be fixed in a 5.18 maintenance release, even though it wasn't discovered until 5.18 was out of maintenance. That didn't happen because the fixing commit was quite complicated. Now that 5.18 is even further past being maintained, there is not going to be a 5.18 maintenance release, so I'm closing this ticket |
@khwilliamson - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#125491 (status was 'resolved')
Searchable as RT125491$
The text was updated successfully, but these errors were encountered: