Opened 16 years ago

Last modified 14 years ago

#430 testing defect (fixed) errors with

Reported by: jnorell Owned by: rjl
Priority: normal Milestone: 1.0.3
Component: Perl scripts Version: 1.0.0
Severity: normal Keywords:



I put in the SA botnet plugin the other day, and find giving errors of redefined subroutines (for every sub that is defined within I found a solution (or workaround?) with a small change to, but I don't know if it's the right solution (not familiar with SA plugins). I don't know if it would be a problem with how is written (I didn't see anything obvious comparing it to the sa plugin wiki), or maybe how the environment is setup on this server. In any case, I'll present the change for consideration.

The errors seen are all like:

Subroutine new redefined at /etc/mail/spamassassin/ line 41.

Running --debug I found they were printed after process_spam was run, and it would be from a subsequent call to process_ham. Both of process_spam and _ham create a new (and local) Mail::SpamAssassin instance; I simply changed those functions to accept $sa in the calling arguments, and instantiate it in the main script body prior to calling them.

Also the $sa->init(1) seems unnecessary there, as every function in looks to call that itsself (perhaps it's in support of previous SA versions?).

Attached is a patch against from 1.0.0 that

resolves the issue. Perhaps the $sa->init(1) call should be wrapped in a check for older SA versions, I don't know, but it works fine without it for me (SA 3.1.3 on gentoo).

Change History (2)

comment:1 Changed 15 years ago by rjl

  • Status changed from new to assigned

The patch appears to have been lost during our server crash late last year, but I agree with what's being proposed here. In fact, I could have sworn I did exactly that in the last revision of, but apparently I did not.

This is the same issue being reported in #452, incidentally--any third-party plug-in for SpamAssassin that isn't properly designed with concurrency in mind will cause these nuisance "redefinition" warnings to appear.

comment:2 Changed 14 years ago by mortonda@…

  • Resolution set to fixed
  • Status changed from assigned to testing

I think I got it recreated in [1422].

I agree Robert, I sure thought you did this, and lots of other calls have a $sa parameter. Odd.

Note: See TracTickets for help on using tickets.