logo       

[SACVS] CVS: spamassassin/lib/Mail/SpamAssassin Bayes.pm,1.95,1.96: msg#00086

mail.spam.spamassassin.cvs

Subject: [SACVS] CVS: spamassassin/lib/Mail/SpamAssassin Bayes.pm,1.95,1.96

Update of /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin
In directory sc8-pr-cvs1:/tmp/cvs-serv8338/lib/Mail/SpamAssassin

Modified Files:
Bayes.pm
Log Message:
bug 2491:
1) the learn_to_journal option was only good for autolearning and using
sa-learn, but "spamassassin -r" just went r/w all the time.

2) when running from spamassassin, caller_will_untie was false.
so when learn() called forget(), forget() would untie, thereby leaving
learn() screwed. this was generating the undefined warnings since the
untie() cleared db_version. so we kluge around that by saving/setting
caller_will_untie, then restoring after the forget().

3) forget() didn't know it could "learn to journal", so it always
went r/w.


Index: Bayes.pm
===================================================================
RCS file: /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/Bayes.pm,v
retrieving revision 1.95
retrieving revision 1.96
diff -b -w -u -d -r1.95 -r1.96
--- Bayes.pm 19 Sep 2003 04:02:40 -0000 1.95
+++ Bayes.pm 23 Sep 2003 00:08:05 -0000 1.96
@@ -660,7 +660,15 @@
warn ("db_seen corrupt: value='$seen' for $msgid. ignored");
} else {
dbg ("$msgid: already learnt as opposite, forgetting first");
+
+ # kluge so that forget() won't untie the db on us ...
+ my $orig = $self->{main}->{learn_caller_will_untie};
+ $self->{main}->{learn_caller_will_untie} = 1;
+
$self->forget ($msg);
+
+ # reset the value post-forget() ...
+ $self->{main}->{learn_caller_will_untie} = $orig;
}
}

@@ -707,7 +715,14 @@
eval {
local $SIG{'__DIE__'}; # do not run user die() traps in here

- if ($self->{store}->tie_db_writable()) {
+ my $ok;
+ if ($self->{main}->{learn_to_journal}) {
+ $ok = $self->{store}->tie_db_readonly();
+ } else {
+ $ok = $self->{store}->tie_db_writable();
+ }
+
+ if ($ok) {
$ret = $self->forget_trapped ($msg, $body, $id);

if (!$self->{main}->{learn_caller_will_untie}) {



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise