Mailing List Archive

[Bug 3217] New: SpamAssassin.pm: "bayes_scanner" may be undefined
http://bugzilla.spamassassin.org/show_bug.cgi?id=3217

Summary: SpamAssassin.pm: "bayes_scanner" may be undefined
Product: Spamassassin
Version: 2.63
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: spamassassin
AssignedTo: spamassassin-dev@incubator.apache.org
ReportedBy: t.d.lee@durham.ac.uk


MailScanner (MS) calls SpamAssassin (SA) via its subroutine interface.

When attempting to rebuild the Bayes database, it consistently
fails in SpamAssassin.pm's "rebuild_learner_caches" subroutine
because {bayes_scanner} is not defined: perl error:
Can't call method "sync" on an undefined value at ... SpamAssassin.pm line 495
(line 495 in SA 2.63 is in "rebuild_learner_caches").

MS's calling sequence is:
$X = new Mail::SpamAssassin(...)
$X->init_learner(...)
$X->rebuild_learner_caches(...)
$X->finish_learner(...)

The fault seems to be a missing initialisation of some sort in
"init_learner", which the "rebuild_learner_caches" later trips over,
because "init_learner" hasn't set up "$self->{bayes_scanner}".

The cure is to include in "init_learner":
$self->{bayes_scanner} = new Mail::SpamAssassin::Bayes($self);
or perhaps something like:
$self->init(1);

Hope that helps. (My knowledge of the internals of SA is tiny,
so the suggested cure may need adapting!)

-- David Lee



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.