Bug 5442 - Provide line continuation facility for rules
Summary: Provide line continuation facility for rules
Status: NEW
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: Other other
: P5 enhancement
Target Milestone: Future
Assignee: SpamAssassin Developer Mailing List
Depends on:
Reported: 2007-04-28 06:52 UTC by Loren Wilton
Modified: 2010-01-27 04:09 UTC (History)
0 users

Attachment Type Modified Status Actions Submitter/CLA Status
Standard "backslash-plus-newline" line-continuation syntax patch None Matthew Cline [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Loren Wilton 2007-04-28 06:52:25 UTC
Some obfuscation rules can be VERY long, and as a result difficult to both read 
and maintain when they aren't generated automatically.  Some other rules can 
also get rather long.

Thus, a simple line continuation facility for rules is suggested.  I believe 
the suggested format is simple enough that it should be quite trivial to 
recognize and handle in parsing, and trivial to glue the rules back together 
when generating the compiled rules.

Allow line continuation with the normal backslash-newline technique.  The 
following line could begin with any amount of whitespace, and the rule 
continuation text would be the first non-whitespace on the line. This second 
line could also be continued in the same manner, etc.  The rule would end with 
a line not containing line continuation.

You could limit this continuation to only inside the regex delimiters, but it 
would be simpler and probably safer to just allow it anywhere in a rule line.  
The various pieces would simply be glued back together by eliminating the line 
continuation characters and any associated whitespace.  (Thus you could not 
break a rule just before whitespace in the regex, but you could perhaps break 
it *after* whitespace in the regex if you wanted to allow that.)
Comment 1 Matthew Cline 2007-11-07 02:02:39 UTC
Created attachment 4183 [details]
Standard "backslash-plus-newline" line-continuation syntax

"backslash at end of line" continuation method, with a few weirdnesses:

1) Empty lines (lines consisting only of whitespace) will be discarded, with
the first non-empty line after a continued line being the one used for

2) Putting a \ at the end of a comment line will make the next line part of the
Comment 2 Mark Martinec 2009-08-06 05:28:13 UTC
For consideration in 3.3.0
Comment 3 Justin Mason 2010-01-27 02:31:48 UTC
moving some 3.3.0-targeted bugs into the vague Future.  feel free to retarget to 3.3.1 if you think you'll be able to work on them
Comment 4 Justin Mason 2010-01-27 03:17:02 UTC
reassigning, too
Comment 5 Mark Martinec 2010-01-27 04:09:31 UTC
Bear in mind that apart from changing the SpamAssassin library,
the supporting tools/scripts and rules QA mechanisms need to be
enhanced too.