Hello Francois,

Francois Mescam wrote:
> I've made some test about this error and to trim to 200 caracters the string
> I modify line 923 to :
> 
> $str =~ s/^(.{0,200}).*$/$1/gs;
> 
> With perl 5.26 there no warning and it gives the result explained by the
> comment.

This modification does truncate the string and does match the comment
but this is still different behavior from the upstream spamassassin
which failed to match and did not previously truncate the lines to
200.  Therefore this change will be a diviation from the behavior we
have had previously.

You are now the test pilot flying the modified aircraft for the first
time.  :-)

Here is my test case.

$ perl -V | head -n1
Summary of my perl5 (revision 5 version 26 subversion 0) configuration:

$ perl -le '$str="12345";$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.
12345

$ perl -le '$str="12345";$str=~s/^(.{0,2}).*$/$1/gs;print $str;'
12

$ perl -le '$str="12345";$str=~s/^(.{2}).*$/$1/gs;print $str;'
12

And also on 5.20.2 in Stable.  Same result in both versions.  Both the
version that warns about this case and older versions that did not warn.

$ perl -V | head -n1
Summary of my perl5 (revision 5 version 20 subversion 2) configuration:

$ perl -le '$str="12345";$str=~s/^(.{,2}).*$/$1/gs;print $str;'
12345

$ perl -le '$str="12345";$str=~s/^(.{0,2}).*$/$1/gs;print $str;'
12

$ perl -le '$str="12345";$str=~s/^(.{2}).*$/$1/gs;print $str;'
12

As you can see ".{,2}" doesn't match and does not truncate the string.
Changing that to ".{0,2}" does truncate the string and as you say does
match the comment.  But the previous version of perl and spamassassin
did not match and the previous result was that the string was NOT
truncated.

Making the change you suggest is all well and good but behaves
differently from the upstream spamassassin due to the addition of 200
character truncation that didn't exist before.

Bob

Attachment: signature.asc
Description: PGP signature

Reply via email to