You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2008/05/27 11:21:58 UTC

svn commit: r660442 - in /spamassassin/branches/3.2: build/preprocessor lib/Mail/SpamAssassin.pm lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm sa-compile.raw

Author: jm
Date: Tue May 27 02:21:57 2008
New Revision: 660442

URL: http://svn.apache.org/viewvc?rev=660442&view=rev
Log:
bug 5899: add perl version string to the storage
area for compiled rulesets, to avoid crashes when perl is upgraded between
major versions and the ABI breaks

Modified:
    spamassassin/branches/3.2/build/preprocessor
    spamassassin/branches/3.2/lib/Mail/SpamAssassin.pm
    spamassassin/branches/3.2/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm
    spamassassin/branches/3.2/sa-compile.raw

Modified: spamassassin/branches/3.2/build/preprocessor
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.2/build/preprocessor?rev=660442&r1=660441&r2=660442&view=diff
==============================================================================
--- spamassassin/branches/3.2/build/preprocessor (original)
+++ spamassassin/branches/3.2/build/preprocessor Tue May 27 02:21:57 2008
@@ -178,6 +178,9 @@
     $perl_version = sprintf("%i.%03i%03i", $v[0] || 0, $v[1] || 0, $v[2] || 0);
   }
 
+  $] =~ /^(\d\.\d\d\d)/ or die "bad perl ver $]";
+  $defines{PERL_MAJOR_VER} = $1;
+
   # Grab active plugin list
   my @plugin_pod = ();
   if (open(INIT, "rules/init.pre")) {

Modified: spamassassin/branches/3.2/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.2/lib/Mail/SpamAssassin.pm?rev=660442&r1=660441&r2=660442&view=diff
==============================================================================
--- spamassassin/branches/3.2/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/branches/3.2/lib/Mail/SpamAssassin.pm Tue May 27 02:21:57 2008
@@ -1706,6 +1706,7 @@
   $path =~ s/__def_rules_dir__/$self->{DEF_RULES_DIR} || ''/ges;
   $path =~ s{__prefix__}{$self->{PREFIX} || $Config{prefix} || '/usr'}ges;
   $path =~ s{__userstate__}{$self->get_and_create_userstate_dir() || ''}ges;
+  $path =~ s{__perl_major_ver__}{$self->get_perl_major_version()}ges;
   $path =~ s/__version__/${VERSION}/gs;
   $path =~ s/^\~([^\/]*)/$self->expand_name($1)/es;
 
@@ -1714,6 +1715,12 @@
   return $path;
 }
 
+sub get_perl_major_version {
+  my $self = shift;
+  $] =~ /^(\d\.\d\d\d)/ or die "bad perl ver $]";
+  return $1;
+}
+
 sub first_existing_path {
   my $self = shift;
   my $path;

Modified: spamassassin/branches/3.2/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.2/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm?rev=660442&r1=660441&r2=660442&view=diff
==============================================================================
--- spamassassin/branches/3.2/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm (original)
+++ spamassassin/branches/3.2/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm Tue May 27 02:21:57 2008
@@ -63,7 +63,7 @@
   my $conf = $params->{conf};
 
   my $instdir = $conf->{main}->sed_path
-			('__local_state_dir__/compiled/__version__');
+                ('__local_state_dir__/compiled/__perl_major_ver__/__version__');
   unshift @INC, $instdir, "$instdir/auto";
   dbg "zoom: loading compiled ruleset from $instdir";
 

Modified: spamassassin/branches/3.2/sa-compile.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.2/sa-compile.raw?rev=660442&r1=660441&r2=660442&view=diff
==============================================================================
--- spamassassin/branches/3.2/sa-compile.raw (original)
+++ spamassassin/branches/3.2/sa-compile.raw Tue May 27 02:21:57 2008
@@ -163,7 +163,7 @@
   $opt{'updatedir'} = Mail::SpamAssassin::Util::untaint_file_path($opt{'updatedir'});
 }
 else {
-  $opt{'updatedir'} = $spamtest->sed_path('__local_state_dir__/compiled/__version__');
+  $opt{'updatedir'} = $spamtest->sed_path('__local_state_dir__/compiled/__perl_major_ver__/__version__');
 }
 my $installdir = $opt{'updatedir'};
 if ((!defined $opt{'list'})
@@ -684,7 +684,7 @@
   --siteconfigpath=path         Path for site configs
                                 (default: /etc/mail/spamassassin)
   --updatedir=path              Directory to place updates
-                      (default: /var/lib/spamassassin/compiled/<version>)
+                      (default: /var/lib/spamassassin/compiled/<perlversion>/<version>)
   --cf='config line'            Additional line of configuration
   -D, --debug [area=n,...]	Print debugging messages
   -V, --version			Print version
@@ -725,7 +725,7 @@
 =item B<--sudo>
 
 Use C<sudo(8)> to run code as 'root' when writing files to the compiled-rules
-storage area (which is C<@@LOCAL_STATE_DIR@@/compiled/@@VERSION@@> by default).
+storage area (which is C<@@LOCAL_STATE_DIR@@/compiled/@@PERL_MAJOR_VER@@/@@VERSION@@> by default).
 
 =item B<--keep-tmps>
 
@@ -746,7 +746,7 @@
 
 By default, C<sa-compile> will use the system-wide rules update directory:
 
-        @@LOCAL_STATE_DIR@@/spamassassin/compiled/@@VERSION@@
+        @@LOCAL_STATE_DIR@@/spamassassin/compiled/@@PERL_MAJOR_VER@@/@@VERSION@@
 
 If the updates should be stored in another location, specify it here.