You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2022/04/21 05:17:25 UTC

svn commit: r1900095 - in /spamassassin/branches/trunk-welcomelist: ./ rules/ t/

Author: hege
Date: Thu Apr 21 05:17:24 2022
New Revision: 1900095

URL: http://svn.apache.org/viewvc?rev=1900095&view=rev
Log:
Add enable_compat welcomelist_blocklist default in init.pre, fix tests

Modified:
    spamassassin/branches/trunk-welcomelist/UPGRADE
    spamassassin/branches/trunk-welcomelist/rules/init.pre
    spamassassin/branches/trunk-welcomelist/t/SATest.pm
    spamassassin/branches/trunk-welcomelist/t/blacklist_autolearn.t
    spamassassin/branches/trunk-welcomelist/t/header_utf8.t
    spamassassin/branches/trunk-welcomelist/t/priorities.t
    spamassassin/branches/trunk-welcomelist/t/spamd_welcomelist_leak.t
    spamassassin/branches/trunk-welcomelist/t/spamd_whitelist_leak.t
    spamassassin/branches/trunk-welcomelist/t/spf.t
    spamassassin/branches/trunk-welcomelist/t/spf_welcome_block.t
    spamassassin/branches/trunk-welcomelist/t/welcomelist_subject.t
    spamassassin/branches/trunk-welcomelist/t/whitelist_from.t
    spamassassin/branches/trunk-welcomelist/t/whitelist_subject.t
    spamassassin/branches/trunk-welcomelist/t/wlbl_uri.t

Modified: spamassassin/branches/trunk-welcomelist/UPGRADE
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/UPGRADE?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/UPGRADE (original)
+++ spamassassin/branches/trunk-welcomelist/UPGRADE Thu Apr 21 05:17:24 2022
@@ -5,7 +5,11 @@ Note for Users Upgrading to SpamAssassin
 - All rules, functions, command line options and modules that contain
   "whitelist" or "blacklist" have been renamed to contain more racially
   neutral "welcomelist" and "blocklist" terms.  Old names will continue work
-  as backwards compatibility atleast until 4.1 release.  (Bug 7826)
+  as backwards compatibility atleast until 4.1 release.  If you have local
+  settings like scores or metas referring to old rule names, these should be
+  changed, after which "enable_compat welcomelist_blocklist" can be added in
+  init.pre.  See: https://wiki.apache.org/spamassassin/WelcomelistBlocklist
+  (Bug 7826)
 
 - Setting normalize_charset is now enabled by default.  Note that rules
   should not expect specific non-UTF8 or UTF8 encoding in body.  Matching is

Modified: spamassassin/branches/trunk-welcomelist/rules/init.pre
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/rules/init.pre?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/rules/init.pre (original)
+++ spamassassin/branches/trunk-welcomelist/rules/init.pre Thu Apr 21 05:17:24 2022
@@ -14,6 +14,15 @@
 # added to new files, named according to the release they're added in.
 ###########################################################################
 
+# Version compatibility - Welcomelist/Blocklist
+# In SpamAssassin 4.0, rules containing "whitelist" or "blacklist" have been
+# renamed to contain more racially neutral "welcomelist" and "blocklist"
+# terms.  When this compatibility flag is enabled, old rule names from stock
+# rules will not hit anymore alongside the new ones.  For more information,
+# see: https://wiki.apache.org/spamassassin/WelcomelistBlocklist
+#
+enable_compat welcomelist_blocklist
+
 # RelayCountry - add metadata for Bayes learning, marking the countries
 # a message was relayed through
 #

Modified: spamassassin/branches/trunk-welcomelist/t/SATest.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/SATest.pm?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/SATest.pm (original)
+++ spamassassin/branches/trunk-welcomelist/t/SATest.pm Thu Apr 21 05:17:24 2022
@@ -344,6 +344,21 @@ sub tstpre {
   print OUT $lines; close OUT;
 }
 
+# remove default compatibility option
+sub disable_compat {
+  my $compat = shift;
+  return unless defined $compat;
+  open (IN, "$siterules/init.pre") or die;
+  open (OUT, ">$siterules/init.pre.new") or die;
+  while (<IN>) {
+    next if $_ =~ /^\s*enable_compat\s+\Q$compat\E(?:\s|$)/i;
+    print OUT $_;
+  }
+  close OUT or die;
+  close IN or die;
+  rename("$siterules/init.pre.new", "$siterules/init.pre");
+}
+
 # Run spamassassin. Calls back with the output.
 # in $args: arguments to run with
 # in $read_sub: callback for the output (should read from <IN>).

Modified: spamassassin/branches/trunk-welcomelist/t/blacklist_autolearn.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/blacklist_autolearn.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/blacklist_autolearn.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/blacklist_autolearn.t Thu Apr 21 05:17:24 2022
@@ -6,6 +6,8 @@ use Test::More tests => 3;
 
 # ---------------------------------------------------------------------------
 
+disable_compat "welcomelist_blocklist";
+
 %patterns = (
   q{ USER_IN_BLACKLIST }, 'blacklisted',
 );

Modified: spamassassin/branches/trunk-welcomelist/t/header_utf8.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/header_utf8.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/header_utf8.t [UTF-8] (original)
+++ spamassassin/branches/trunk-welcomelist/t/header_utf8.t [UTF-8] Thu Apr 21 05:17:24 2022
@@ -47,7 +47,7 @@ plan tests => $tests;
   q{/ LT_NOTE /}      => 'LT_NOTE',
   q{/ LT_UTF8SMTP_ANY /}    => 'LT_UTF8SMTP_ANY',
   q{/ LT_SPLIT_UTF8_SUBJ /} => 'LT_SPLIT_UTF8_SUBJ',
-  q{/ USER_IN_BLACKLIST /}  => 'USER_IN_BLACKLIST',
+  q{/ USER_IN_BLOCKLIST /}  => 'USER_IN_BLOCKLIST',
 );
 
 %mypatterns_utf8 = (  # as it appears in a report body

Modified: spamassassin/branches/trunk-welcomelist/t/priorities.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/priorities.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/priorities.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/priorities.t Thu Apr 21 05:17:24 2022
@@ -7,6 +7,8 @@ use Test::More tests => 10;
 
 use Mail::SpamAssassin;
 
+disable_compat "welcomelist_blocklist";
+
 tstlocalrules (q{
 
   priority USER_IN_WHITELIST     -1000

Modified: spamassassin/branches/trunk-welcomelist/t/spamd_welcomelist_leak.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/spamd_welcomelist_leak.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/spamd_welcomelist_leak.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/spamd_welcomelist_leak.t Thu Apr 21 05:17:24 2022
@@ -33,7 +33,7 @@ close OUT;
 
 %patterns = (
   q{ 99 MYBODY }, 'MYBODY',
-  q{-0.0 USER_IN_WELCOMELIST }, 'USER_IN_WELCOMELIST',
+  q{-100 USER_IN_WELCOMELIST }, 'USER_IN_WELCOMELIST',
 );
 %anti_patterns = (
 );

Modified: spamassassin/branches/trunk-welcomelist/t/spamd_whitelist_leak.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/spamd_whitelist_leak.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/spamd_whitelist_leak.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/spamd_whitelist_leak.t Thu Apr 21 05:17:24 2022
@@ -11,6 +11,8 @@ plan tests => 8;
 # ---------------------------------------------------------------------------
 # bug 6003
 
+disable_compat "welcomelist_blocklist";
+
 tstlocalrules (q{
   body MYBODY /LOSE WEIGHT/
   score MYBODY 99

Modified: spamassassin/branches/trunk-welcomelist/t/spf.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/spf.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/spf.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/spf.t Thu Apr 21 05:17:24 2022
@@ -15,6 +15,8 @@ plan tests => 72;
 
 # ---------------------------------------------------------------------------
 
+disable_compat "welcomelist_blocklist";
+
 # ensure all rules will fire
 tstlocalrules ("
   score SPF_FAIL 0.001

Modified: spamassassin/branches/trunk-welcomelist/t/spf_welcome_block.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/spf_welcome_block.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/spf_welcome_block.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/spf_welcome_block.t Thu Apr 21 05:17:24 2022
@@ -26,7 +26,7 @@ tstlocalrules ("
   score SPF_PASS -0.001
   score SPF_HELO_PASS -0.001
   score USER_IN_DEF_SPF_WL -0.001
-  score USER_IN_SPF_WHITELIST -0.001
+  score USER_IN_SPF_WELCOMELIST -0.001
 ");
 
 %patterns = (
@@ -307,7 +307,7 @@ tstprefs("
 %patterns = (
   q{ SPF_HELO_PASS }, 'helo_pass',
   q{ SPF_PASS }, 'pass',
-  q{ USER_IN_SPF_WHITELIST }, 'spf_whitelist',
+  q{ USER_IN_SPF_WELCOMELIST }, 'spf_whitelist',
   q{ USER_IN_DEF_SPF_WL }, 'default_spf_whitelist',
 );
 
@@ -328,7 +328,7 @@ tstprefs("
 );
 
 %anti_patterns = (
-  q{ USER_IN_SPF_WHITELIST }, 'spf_whitelist',
+  q{ USER_IN_SPF_WELCOMELIST }, 'spf_whitelist',
   q{ USER_IN_DEF_SPF_WL }, 'default_spf_whitelist',
 );
 
@@ -350,7 +350,7 @@ tstprefs("
 %patterns = (
   q{ SPF_HELO_PASS }, 'helo_pass',
   q{ SPF_PASS }, 'pass',
-  q{ USER_IN_SPF_WHITELIST }, 'spf_whitelist',
+  q{ USER_IN_SPF_WELCOMELIST }, 'spf_whitelist',
   q{ USER_IN_DEF_SPF_WL }, 'default_spf_whitelist',
 );
 
@@ -480,7 +480,7 @@ tstprefs("
 );
 
 %anti_patterns = (
-  q{ USER_IN_SPF_WHITELIST }, 'spf_whitelist',
+  q{ USER_IN_SPF_WELCOMELIST }, 'spf_whitelist',
   q{ USER_IN_DEF_SPF_WL }, 'default_spf_whitelist',
 );
 

Modified: spamassassin/branches/trunk-welcomelist/t/welcomelist_subject.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/welcomelist_subject.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/welcomelist_subject.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/welcomelist_subject.t Thu Apr 21 05:17:24 2022
@@ -7,11 +7,11 @@ use Test::More tests => 4;
 # ---------------------------------------------------------------------------
 
 %is_welcomelist_patterns = (
-  q{ SUBJECT_IN_WHITELIST }, 'welcomelist-subject'
+  q{ SUBJECT_IN_WELCOMELIST }, 'welcomelist-subject'
 );
 
 %is_blocklist_patterns = (
-  q{ SUBJECT_IN_BLACKLIST }, 'blocklist-subject'
+  q{ SUBJECT_IN_BLOCKLIST }, 'blocklist-subject'
 );
 
 tstprefs ("

Modified: spamassassin/branches/trunk-welcomelist/t/whitelist_from.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/whitelist_from.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/whitelist_from.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/whitelist_from.t Thu Apr 21 05:17:24 2022
@@ -9,6 +9,8 @@ plan tests => 32;
 
 # ---------------------------------------------------------------------------
 
+disable_compat "welcomelist_blocklist";
+
 tstprefs ("
   def_whitelist_from_rcvd *\@paypal.com paypal.com
   def_whitelist_from_rcvd *\@paypal.com ebay.com

Modified: spamassassin/branches/trunk-welcomelist/t/whitelist_subject.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/whitelist_subject.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/whitelist_subject.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/whitelist_subject.t Thu Apr 21 05:17:24 2022
@@ -6,6 +6,8 @@ use Test::More tests => 4;
 
 # ---------------------------------------------------------------------------
 
+disable_compat "welcomelist_blocklist";
+
 %is_whitelist_patterns = (
   q{ SUBJECT_IN_WHITELIST }, 'whitelist-subject'
 );

Modified: spamassassin/branches/trunk-welcomelist/t/wlbl_uri.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/trunk-welcomelist/t/wlbl_uri.t?rev=1900095&r1=1900094&r2=1900095&view=diff
==============================================================================
--- spamassassin/branches/trunk-welcomelist/t/wlbl_uri.t (original)
+++ spamassassin/branches/trunk-welcomelist/t/wlbl_uri.t Thu Apr 21 05:17:24 2022
@@ -4,6 +4,8 @@ use lib '.'; use lib 't';
 use SATest; sa_t_init("wlbl_uri");
 use Test::More tests => 12;
 
+disable_compat "welcomelist_blocklist";
+
 %patterns = (
   q{ 0.0 URI_HOST_IN_BLOCKLIST }, 'hit-blo',
   q{ 100 URI_HOST_IN_BLACKLIST }, 'hit-bla',