You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2018/09/06 00:29:19 UTC
[Bug 7616] New: Test fail due to change in Util.pm sub wrap
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
Bug ID: 7616
Summary: Test fail due to change in Util.pm sub wrap
Product: Spamassassin
Version: 3.4 SVN branch
Hardware: PC
OS: Windows NT
Status: NEW
Severity: blocker
Priority: P2
Component: Regression Tests
Assignee: dev@spamassassin.apache.org
Reporter: kmcgrail@apache.org
Target Milestone: Undefined
Make test currently fails:
Test Summary Report
-------------------
t/desc_wrap.t (Wstat: 1024 Tests: 10 Failed: 4)
Failed tests: 4-5, 9-10
Non-zero exit status: 4
t/util_wrap.t (Wstat: 512 Tests: 5 Failed: 2)
Failed tests: 2, 5
Non-zero exit status: 2
Reverting this change resolves the issue.
https://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Util.pm?r1=1839832&r2=1839831&pathrev=1839832
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 7616] REVIEW: Test fail due to change in Util.pm sub wrap
Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
Kevin A. McGrail <km...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Target Milestone|Undefined |3.4.2
Resolution|--- |FIXED
--- Comment #8 from Kevin A. McGrail <km...@apache.org> ---
Thanks for the quick reviews on this.
+1 to attached patch for 3.4
-1 to attached patch for trunk. As noted in bug 7615, SA 4.0 should have a min
required perl that is high enough for this function.
Henrik, love the performance numbers.
With 3 +1's (Bill's Implicit), committing to 3.4: Committed revision 1840213.
For Trunk, Committed revision 1840214 and see bug 7615. Trunk is not in C-T-R.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 7616] REVIEW: Test fail due to change in Util.pm sub wrap
Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
--- Comment #7 from Henrik Krohns <he...@hege.li> ---
Just for fun, here are some benchmarks (fastest time) for alternatives I came
up with, running wrap() dozen times through a 40MB mbox. Also verified all had
identical output.
I'm amazed that the 5.14 way is consistently 10% faster. :-D Perhaps
we can return to it when minimum version is raised.
orig 11.53s
my $len = length ($arr[$pos] =~ s/\t/ /gr);
if ($pos_mod != 0 && $overflow == 0) {
$len += length ($arr[$pos+1] =~ s/\t/ /gr);
hege 12.68s
my $len = length ($arr[$pos]);
$tabs = $arr[$pos] =~ tr/\t//;
$len += $tabs*7 if $tabs;
if ($pos_mod != 0 && $overflow == 0) {
$len += length($arr[$pos+1]);
$tabs = $arr[$pos+1] =~ tr/\t//;
$len += $tabs*7 if $tabs;
bill 12.77s
my $tmpline = $arr[$pos] ;
$tmpline =~ s/\t/ /g;
my $len = length ($tmpline);
if ($pos_mod != 0 && $overflow == 0) {
my $tmpnext = $arr[$pos+1] ;
$tmpnext =~ s/\t/ /g;
$len += length ($tmpnext);
hege2 13.17s
my $len = length ($arr[$pos]);
$len += 7 while ($arr[$pos] =~ /\t/g);
if ($pos_mod != 0 && $overflow == 0) {
$len += length ($arr[$pos+1]);
$len += 7 while ($arr[$pos+1] =~ /\t/g);
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 7616] REVIEW: Test fail due to change in Util.pm sub wrap
Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
Bill Cole <bi...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Test fail due to change in |REVIEW: Test fail due to
|Util.pm sub wrap |change in Util.pm sub wrap
--- Comment #4 from Bill Cole <bi...@apache.org> ---
THIS PATCH NEEDS REVIEW AND VOTES!
Last week, we fixed a slightly imperfect header-folding flaw (due to treating
tabs as single characters) by implementing a configurable header-folding width
and counting tabs as 8 characters. Because the first implementation of
"counting tabs as 8 characters" used a Perl 5.14 feature, that was turning into
"convert tabs to 8 spaces," and imperfect solution that would have been fine,
since the only tabs this code sees are at the start of lines.
That change broke (as revealed by t/util_wrap.t) due to a quirk of nested
operations which caused a length() call to always see a null string instead of
a substituted string. This patch re-implements the functionality of the "r"
modifier to the s/// regex substitution operation by copying the string to a
scratch variable which is substituted and then measured, leaving the original
fully intact.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 7616] Test fail due to change in Util.pm sub wrap
Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
--- Comment #3 from Bill Cole <bi...@apache.org> ---
Created attachment 5594
--> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5594&action=edit
simulate "r" modifier (added in 5.14) removed in r1839832
Unintuitively, these length() calls always return zero:
length ($arr[$pos] =~ s/\t/ /g);
length ($arr[$pos+1] =~ s/\t/ /g);
They work with the /r modifier, but that is not in Perl until v5.14
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 7616] Test fail due to change in Util.pm sub wrap
Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
Kevin A. McGrail <km...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kmcgrail@apache.org
--- Comment #1 from Kevin A. McGrail <km...@apache.org> ---
Bill, can you shed light on this change please?
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 7616] REVIEW: Test fail due to change in Util.pm sub wrap
Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
--- Comment #9 from Kevin A. McGrail <km...@apache.org> ---
Sorry, Trunk *is* in C-T-R.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 7616] REVIEW: Test fail due to change in Util.pm sub wrap
Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
--- Comment #6 from Henrik Krohns <he...@hege.li> ---
Uh never mind my brain fart, of course s/\t/[ ]{8}/g is not going to work.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 7616] REVIEW: Test fail due to change in Util.pm sub wrap
Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
Henrik Krohns <he...@hege.li> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hege@hege.li
--- Comment #5 from Henrik Krohns <he...@hege.li> ---
+1 looks fine to me
One nitpick, could we perhaps change this to s/\t/[ ]{8}/g; since the original
is quite unreadable and looks probe to break.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 7616] Test fail due to change in Util.pm sub wrap
Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7616
Bill Cole <bi...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |billcole@apache.org
--- Comment #2 from Bill Cole <bi...@apache.org> ---
(In reply to Kevin A. McGrail from comment #1)
> Bill, can you shed light on this change please?
The 'r' modifier isn't available before Perl 5.14. It didn't seem absolutely
necessary here but I apparently misunderstood the code.
I'm trying to replicate the /r behavior in code.
--
You are receiving this mail because:
You are the assignee for the bug.