-
Notifications
You must be signed in to change notification settings - Fork 577
5.23.8 + "Assuming NOT a POSIX" causes spurious warning in PPIx::Regexp::Token::Literal #15190
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
Comments
From @kentfredricThis is a bug report for perl from kentnl@cpan.org, The following line of code raises a warning, despite looking like legal use of POSIX character classes: https://metacpan.org/source/WYANT/PPIx-Regexp-0.047/lib/PPIx/Regexp/Token/Literal.pm#L242 This cascades into Perl::Critic::Pulp where that warning becomes an error: http://www.cpantesters.org/cpan/report/3df914e0-d0cb-11e5-82fe-70d067b6c32e The code in question doesn't seem obviously wrong: c [][[:alpha:]\@\\^_?] | # control characters Flags: Site configuration information for perl 5.23.8: Configured by kent at Sun Feb 21 13:35:32 NZDT 2016. Summary of my perl5 (revision 5 version 23 subversion 8) configuration: @INC for perl 5.23.8: Environment for perl 5.23.8: |
From @tonycozOn Sat Feb 20 18:36:56 2016, kentfredric wrote:
$ ./perl -Ilib -We 'qr/[][[:alpha:]]/' Tony |
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Sat Feb 20 18:36:56 2016, kentfredric wrote:
In fact, I don’t see *anything* wrong with it. It looks as though this new warning is always going to trigger false positives. I can’t see any way around that (except by removing the warning). -- Father Chrysostomos |
From @khwilliamsonOn 02/20/2016 10:42 PM, Father Chrysostomos via RT wrote:
Actually, it is fairly easy to get rid of this entire class of false The changes I made do not change what actually get compiled. So this |
From @trwyantThis warning is suppressed in PPIx-Regexp 0.048, which went to PAUSE yesterday. There's no test coverage tool that I know of to test regex coverage, but I believe the regex was functioning correctly. What happened was that the lazy way to include a right square bracket in a bracketed character class is to put it first. Having square brackets on the brain, I put the left square bracket next, and followed with the POSIX class. The fix was to shuffle the \@ before the POSIX class, as suggested by perldiag. I admit that I grumbled to myself a little over this, but on reflection it's no different than shuffling that right square bracket to the front. As I noted to a correspondent on this issue, Perl is so overloaded that it is fairly easy to write something that is valid Perl but nevertheless quite different than the author's intention, and warnings like this have a long history. But if you will allow the opinion of someone whose normal involvement with the porters' mailing list is reading (with profound thanks!) SawyerX's summaries, I personally would appreciate the suppression of the false positive (which I believe this is) if it can be done without eliminating the message completely. With thanks to all of you for the continuous improvement of Perl 5, |
From @khwilliamsonThis has been fixed by b7c50ab I forgot to flesh out the commit message, so here is some more detail: Basically the fix is to delay the warning message until we are sure it was not a false positive. In the failure from this ticket: /[][[:alpha:]] it sees the 2nd '[' (the 3rd character within the pattern, immediately after a ']') and starts looking for a posix class. It finds one at that position, but with an apparent typo: '[[:alpha:]. So it raised a warning. Now, instead, it saves the warning. Then it starts parsing at the next '[' and sees a legitimate class '[:alpha:]', and it then compiled that, but the warning had already escaped. With this commit, the warning will be cleared if a later legitimate class is found that overlaps the area the warning was about. |
@khwilliamson - Status changed from 'open' to 'pending release' |
From @khwilliamsonOn 03/01/2016 09:44 AM, Tom Wyant via RT wrote:
I'm sorry that you felt you had to change your code. Your code was There will be false positives with this new warning, but there should |
From @khwilliamsonThank you for submitting this report. You have helped make Perl better. Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0 |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#127581 (status was 'resolved')
Searchable as RT127581$
The text was updated successfully, but these errors were encountered: