Bug#869955: warning with perl 5.24

2017-08-01 Thread Bob Proulx
Noah Meyerhans wrote:
> Ivan Sergio Borgonovo wrote:
> > After upgrading perl to 5.26.0-4 I get:
> > 
> > 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 /usr/share/perl5/Mail/SpamAssassin/PerMsgStatus.pm line 923. 
> > Learned tokens from 1 message(s) (1494 message(s) examined)

Noah, Thanks for dealing with this!

I thought I would add a little more background information for those
who happen upon this and then read this report.  I returned from
travels and upgraded a system and hit this myself and dug into the
details a little bit. :-)

> Thanks for the report. This has been fixed in upstream svn with the
> following commit:
> https://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?r1=1708863=1791010_format=h
> 
> I'll either backport the fix or (preferably) package a forthcoming
> upstream release...

The old statement in the previous verison is:

  $str =~ s/^(.{,200}).*$/$1/gs;

And specifically the problem is this part which can be recreated on
the command line like this:

  $ perl -le '$str="foo";$str=~s/^(.{,2}).*$/$1/gs;print $str;'
  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 ,2}).*$/ 
at -e line 1.
  foo

A three character string "foo" was attempted to be truncated to a two
character string.  This was an attempted truncation to 200 characters
in the original.  But this fails to match and therefore doesn't do
anything.  The new perl version warns in this case.  A good warning
because it catches something that wasn't matching anything.

The perlre docs say:

   {n} Match exactly n times
   {n,}Match at least n times
   {n,m}   Match at least n but not more than m times

Therefore the syntax {,200} doesn't match as intended.  It doesn't
follow any of the above three syntaxes.  The fix as indicated by the
commit referenced changes that line to:

  $str =~ s/^(.{200}).+$/$1 [...]/gm;

The essential part is ".{,200}" becomes ".{200}" which addresses this
problem.  The rest is other code refactoring which works in
association with other parts of the commit which I am not showing.

What was happening with previous versions of perl is that AFAICT
nothing was happening.  The expression was not matching and no
truncation to 200 characters was occuring.

Therefore if one wanted to avoid this warning from perl and change
nothing else from the previous behavior it would be sufficient to
comment out that line as a local hack.  That will stop the warning and
everything will behave exactly as it was behaving in the previous perl
version with respect to this warning.

In file /usr/share/perl5/Mail/SpamAssassin/PerMsgStatus.pm line 923:

  -$str =~ s/^(.{,200}).*$/$1/gs;
  +# $str =~ s/^(.{,200}).*$/$1/gs;

And then when the new upstream is available, packaged and distributed
it will replace the file with the real fix for this problem.  The file
will get updated and the local modification will be replaced with the
updated contents of file at the next update of it.

Hope this helps people with a quick summary of the details of the
problem. :-)

Bob



Bug#869955: warning with perl 5.24

2017-07-27 Thread Noah Meyerhans
Control: tags -1 + upstream fixed-upstream newcomer

On Fri, Jul 28, 2017 at 01:40:24AM +0200, Ivan Sergio Borgonovo wrote:
> After upgrading perl to 5.26.0-4 I get:
> 
> 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 /usr/share/perl5/Mail/SpamAssassin/PerMsgStatus.pm line 923.
> Learned tokens from 1 message(s) (1494 message(s) examined)

Thanks for the report. This has been fixed in upstream svn with the
following commit:
https://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?r1=1708863=1791010_format=h

I'll either backport the fix or (preferably) package a forthcoming
upstream release...

noah



Bug#869955: warning with perl 5.24

2017-07-27 Thread Ivan Sergio Borgonovo

Package: spamassassin
Version: 3.4.1-7

After upgrading perl to 5.26.0-4 I get:

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 /usr/share/perl5/Mail/SpamAssassin/PerMsgStatus.pm 
line 923.

Learned tokens from 1 message(s) (1494 message(s) examined)

Just a warning, spamassassin seems to work.

There is no newer upstream.


thanks

--
Ivan Sergio Borgonovo
http://www.webthatworks.it http://www.borgonovo.net