Bug 6233 - What values are valid/recommended for SYMBOLIC_TEST_NAME?
Summary: What values are valid/recommended for SYMBOLIC_TEST_NAME?
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Documentation (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: All All
: P5 minor
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-05 12:00 UTC by Adam Katz
Modified: 2019-07-31 05:05 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Katz 2009-11-05 12:00:37 UTC
(Filed as a documentation bug, but perhaps better suited elsewhere...)

I had thought SYMBOLIC_TEST_NAME had to match /^(__)?[A-Z][A-Z_0-9]+$/ but there is a small number of rules that do not ... namely, rules in 20_freemail.cf (subrules only), 20_ratware.cf (subrules starting with __0), sandboxes emailed/00_FVGT_File001.cf (trailing lowercases), hege/20_hk.cf, hege/20_hk_dev.cf, and jm/80_sane.cf (trailing hashes using lowercase), plus many SARE rules and 72_active.cf has a hit (__FB_BCs) in updates.spamassassin.org (for 3.2.5) but not in subversion.

There does not appear to be a document stating what these can legally be nor are there suggestions aside from those pertaining to prefixing custom rules at http://wiki.apache.org/spamassassin/WritingRules#Rule_name_suggestions

http://spamassassin.apache.org/full/3.2.x/doc/Mail_SpamAssassin_Conf.html states that a description is best kept under 50 characters, but it never actually defines anything about what can and cannot be included in descriptions and SYMBOLIC_TEST_NAME.

Can symbolic test names be of any length and include any nonspace characters?  I'm doubting it...

Here's how I got a list as sorted by filename:

----
cd /path/to/spamassassin/svn/trunk

find * -name '*.cf' |xargs grep . |perl -ne 'if (/^(\S+):\s*(?:lang\s+\S+\s+)?(?:describe|score|tflags|priority|test|header|full|(?:raw)?body|meta|uri)\s+/) { my $file=$1; s///; s/\s.*//; print "$file: $_" unless /^(?:__)?[A-Z][A-Z_0-9]{1,50}$/; }' |sort |uniq

cd /var/lib/spamassassin/3.002005; !!
----


(It's amazing how much I've learned just by writing a syntax file for SA configs... see http://www.vim.org/scripts/script.php?script_id=2617 ... which I might want to check into svn once I get write access.)
Comment 1 Henrik Krohns 2019-07-31 05:05:08 UTC
This was added in 3.4.3 to try to enforce it uniformly.

use constant RULENAME_RE => qr([_a-zA-Z][_a-zA-Z0-9]{0,127});

Added a small blurp in docs.

Sending        spamassassin-3.4/lib/Mail/SpamAssassin/Conf.pm
Sending        trunk/lib/Mail/SpamAssassin/Conf.pm
Transmitting file data ..done
Committing transaction...
Committed revision 1864032.