Bug 7369 - Unescaped left brace in regex is deprecated
Summary: Unescaped left brace in regex is deprecated
Status: RESOLVED DUPLICATE of bug 7404
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
: 7576 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-11-11 22:28 UTC by chorny
Modified: 2018-04-19 17:57 UTC (History)
6 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description chorny 2016-11-11 22:28:32 UTC
This is new warning in 5.24 and in 5.26 it will be fatal error.

Unescaped left brace in regex is deprecated here, passed through in regex; marked by <-- HERE in m/^(.{ <-- HERE ,200}).*$/ at ../blib/lib/Mail/SpamAssassin/PerMsgStatus.pm line 921.

See for ex. http://www.cpantesters.org/cpan/report/2175cb2a-69fe-11e6-b500-799f71b19ea6
Comment 1 John Hardin 2016-11-11 22:32:58 UTC
...so now you have to explicitly say ".{0,nnn}" for "0-n instances of"?

How many REs does this change break worldwide?
Comment 2 John Hardin 2016-11-11 22:44:32 UTC
Looks like it. The perlre documentation does not mention the {,n} quantifier syntax, back as far as 5.12. I don't know when that change occurred, but it looks like we need to clean up the code and potentially the rules to do explicit {0,n} quantifiers, and post a warning on the users list for people to review their local rules.

How many versions back do we fix this?
Comment 3 chorny 2016-11-12 01:27:55 UTC
(In reply to John Hardin from comment #1)
> ...so now you have to explicitly say ".{0,nnn}" for "0-n instances of"?

Tested /a{,2}/ on perl 5.14.0. It does not work as /a{0,2}/. But it is same as /a\{,2\}/.
Comment 4 John Hardin 2016-11-12 03:13:34 UTC
...ugh. Is that sed I'm remembering then that supports the {,n} syntax?
Comment 5 Joe Quinn 2017-02-04 15:31:47 UTC
$ grep --recursive '{,' lib/
lib/Mail/SpamAssassin/PerMsgStatus.pm:  $str =~ s/^(.{,200}).*$/$1/gs;

Looks like this is the only regex that is affected.
Comment 6 James Lee 2017-07-04 10:41:57 UTC
(In reply to chorny from comment #3)

> Tested /a{,2}/ on perl 5.14.0. It does not work as /a{0,2}/. But it is same
> as /a\{,2\}/.

"does not work" is surely defined by the comment above the failed regex:

  # in case the last line was huge, trim it back to around 200 chars

and "{,2}" does not work to trim the line in earlier version of perl either.

To trim the line to 200 chars "s/^(.{0,200}).*$/$1/gs" should be correct.



Any reason why something so basic has been left for 8 month?  Is spamassassin unmaintained?

Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/^(.{ <-- HERE ,200}).*$/ at /opt/xxxx/lib/perl5/xxxx/Mail/SpamAssassin/PerMsgStatus.pm line 921.

Note: and will be **fatal** in Perl 5.30
Comment 7 Bill Cole 2017-07-05 02:26:05 UTC
Fixed in r1791013 for Bug #7404

*** This bug has been marked as a duplicate of bug 7404 ***
Comment 8 Kevin A. McGrail 2018-04-19 17:57:53 UTC
*** Bug 7576 has been marked as a duplicate of this bug. ***