https://issues.apache.org/SpamAssassin/show_bug.cgi?id=7107

            Bug ID: 7107
           Summary: if() preprocessor directive should support a test for
                    perl version
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Rules
          Assignee: [email protected]
          Reporter: [email protected]

SA 3.4 supports perl 5.8.8 and above.

There are perl RE syntax elements (like ++) that were introduced after that
version, so if a rule includes such syntax the rule will fail lint on older
perl (e.g. during sa-update) even though it passes on newer perl (e.g. on
RuleQA).

Unfortunately the SA preprocessor parser allows only very limited elements of
perl, and neither $] (old) nor $^V (current) are included in that subset, so
this can't be done:

if ($^V ge v5.10)
  body POST_588_RE  /\w++/
endif

That causes:

config: unparseable chars in 'if ($^V ge v5.10)': 'V'
config: unparseable chars in 'if ($^V ge v5.10)': '.10'
lint: bad 'if' line, in "rules/72_active.cf" at build/mkrules line 255.

Request:

Have the preprocessor parse/permit $^V and version numbers so that such checks
can be performed, or define a "perl_version" preprocessor var similar to the
existing "version" so that we can do this:

if perl_version >= 5.010000
  body POST_588_RE  /\w++/
endif

perl_version seems a better option, as it doesn't cause a lint failure, and
if() fails to "false" if the expression syntax is bad, so the risky RE would be
disabled by default in older SA.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to