SpamAssassin Install Prefix

Mariano Absatz mailscanner at LISTS.COM.AR
Wed Apr 30 16:03:12 IST 2003


Hi Julian,

the patch below is a little more general... it can only get confused if 
there's more than one SpamAssassin with the same "SpamAssassin Install 
Prefix" for different Perl installations... a relativeley unlikely event that 
will probably have other side effects besides this one...

Anyway, it will complain in the log if this happens, and will show you which 
version it is using.

El 29 Apr 2003 a las 17:48, Mariano Absatz escribió:

> Hi Julian,
> 
> I installed SpamAssassin in an unusual place (say... /opt/SpamAssassin),
> configured it in the options like:
>  SpamAssassin Install Prefix = /opt/SpamAssassin
> 
> and it didn't work... browsing the log I see repeatedly:
> Apr 29 17:29:20 alerce2-or Alerce-MX[17638]: MailScanner E-Mail Virus Scanner
> version 4.15-9 starting...
> Apr 29 17:29:20 alerce2-or Alerce-MX[17638]: SpamAssassin installation could
> not be found
> 
> and looking at SA.pm I see that you don't prepend the possibly modified
> directory to the @INC array...
> 
*** SA.pm.old   Tue Apr 29 17:33:11 2003
--- SA.pm       Wed Apr 30 11:58:53 2003
***************
*** 72,77 ****
--- 72,101 ----
  
    unless (MailScanner::Config::IsSimpleValue('usespamassassin') &&
            !MailScanner::Config::Value('usespamassassin')) {
+     # BBY 2003-04-30: this is necessary for the "require Mail::SpamAssassin" 
+     # to work if spamassassininstallprefix is not in the standard @INC or
+     # is not the in the same place as MailScanner (that was pushed onto @INC
+     # earlier)
+     $val = MailScanner::Config::Value('spamassassininstallprefix');
+     if ($val ne "") {
+       $settings{PREFIX} = $val;
+       $val .= "/lib/perl5/site_perl/5*";
+       my $libdir;
+       my $libsfound=0;
+       foreach $libdir (glob($val)) {
+         if ( -f $libdir . "/Mail/SpamAssassin.pm" ) {
+                 unshift @INC, $libdir unless $libsfound;
+         ++$libsfound;
+         }
+       }
+       if ($libsfound < 1) {
+         MailScanner::Log::WarnLog("SpamAssassin not found in %s",$val);
+       }
+       elsif ($libsfound > 1) {
+         MailScanner::Log::WarnLog("More than one SpamAssassin found in %s."
+                    . " Using the one at %s",$val,$INC[0]);
+       }
+     }
      MailScanner::Log::DieLog("SpamAssassin installation could not be found")
        unless eval "require Mail::SpamAssassin";
      $settings{dont_copy_prefs} = 1; # Removes need for home directory
***************
*** 79,94 ****
      $settings{userprefs_filename} = $prefs if defined $prefs;
      $val = MailScanner::Config::Value('debugspamassassin');
      $settings{debug} = $val;
-     # Bunch of extra settings only used by Tony Finch, so not mentioned
-     # in supplied MailScanner.conf file.
      $val = MailScanner::Config::Value('spamassassinuserstatedir');
      $settings{userstate_dir} = $val if $val ne "";
      $val = MailScanner::Config::Value('spamassassinlocalrulesdir');
      $settings{LOCAL_RULES_DIR} = $val if $val ne "";
      $val = MailScanner::Config::Value('spamassassindefaultrulesdir');
      $settings{DEF_RULES_DIR} = $val if $val ne "";
-     $val = MailScanner::Config::Value('spamassassininstallprefix');
-     $settings{PREFIX} = $val if $val ne "";
      $MailScanner::SA::SAspamtest = new Mail::SpamAssassin(\%settings);
  
      #if ($prefs ne "") {
--- 103,114 ----



--
Mariano Absatz
El Baby
----------------------------------------------------------
Ambivalent? Well, yes and no.




More information about the MailScanner mailing list