SA Bugzilla – Bug 5253
SA seems to pass an invalid parameter to TextWrap, resulting in "matches many times" message
Last modified: 2006-12-25 22:46:44 UTC
The following description was posted on the user's list by Linda Walsh, who did the analysis. It appears to me that she has a pretty decent case for the TextWrap problem actually being a small SA bug in the parameters that are passed to the module. The error message started appearing in versions of TextWrap that started using the incorrect parameter. ---------------------------- I looked at this error and it appears to be caused by SpamAssassin passing in an incorrect parameter to "Text::Wrap" by changing the value of "Text::Wrap::break" to be something other than a "line breaking" character (or characters). In file in my Spamassassin-3.17 cpan dir, there is a bad line: ./lib/Mail/SpamAssassin/PerMsgStatus.pm:996: $hdr = Mail::SpamAssassin::Util::wrap($hdr, "\t", "", 79, 0, '(?<=[\s,])'); The last argument, '(?<=[\s,])' appears to be invalid. The error message is "(?:(?<=[\s,]))* matches null string many \ times in regex; marked by <-- HERE in m/\G(?:(?<=[\s,]))* <-- \ HERE \Z/ at /usr/lib/perl5/5.8.8/Text/Wrap.pm line 46. " In the Text::Wrap source code of 0704 (last working version), there is (at line 46, remarkably enough:-)), the line: while ($t !~ /\G\s*\Z/gc) { In versions 0711 and later, that line reads: while ($t !~ /\G(?:$break)*\Z/gc) { ===== Note that "\s" has been replaced by "(?:$break)". In the 0711 source code, $break defaults to '\s'. In other words -- it appears, from the code it replaces and from the default values of "$break" that "$break" should contain a pattern representing the characters to break on. However, in PerMsgStatus:996, we see a *zero-length* (the "(?<=pat)" part) pattern passed in for the value of $break. Instead of matching the line "break" character, it only matches the position and never matches the character itself -- thus it gets "stuck" applying the zero-length (null pattern) again and again (thus the message "<bad expr> matches null string many times....". I'm not sure what the author was trying to do in PerMsgStatus.pm or who "owns" that "line" (or file), but perhaps they meant for "comma" to be included in the list of "break" characters. In which case, instead of: '(?<=[\s,])' for the last argument in line 996, it should be: '[\s,]' That is, line 996 in lib/Mail/SpamAssassin/PerMsgStatus.pm should be: $hdr = Mail::SpamAssassin::Util::wrap($hdr, "\t", "", 79, 0, '[\s,]'); (instead of: $hdr = Mail::SpamAssassin::Util::wrap($hdr, "\t", "", 79, 0, '(?<=[\s,])'); ) I hope this was helpful? Linda
the discussion is continuing in bug 5056, so closing this as a duplicate. *** This bug has been marked as a duplicate of 5056 ***