You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2004/01/11 23:10:52 UTC
[Bug 2919] New: Bayes: Sanity check missing from expiry code
http://bugzilla.spamassassin.org/show_bug.cgi?id=2919
Summary: Bayes: Sanity check missing from expiry code
Product: Spamassassin
Version: 2.61
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P5
Component: spamassassin
AssignedTo: spamassassin-dev@incubator.apache.org
ReportedBy: sa-talk@j-e-b.net
When doin expiry sa copies over the database content to a new temporary
database. The name of the db is fixed. It may happen that the expiry is
interrupted. In this case a damaged temporary db is left behind. In the next
run, sa will use that same db again, which will lead to either corrupted content
or a complete failure (likely endless loop in DB_File).
Here's a small sanity check for this. It's two changes to BayesStore.pm sub
expire_old_tokens_trapped(). Near the beginning:
# since DB_File will not shrink a database (!!), we need to *create*
# a new one instead.
my $main = $self->{bayes}->{main};
my $path = $main->sed_path ($main->{conf}->{bayes_path});
my $name = $path.'_toks.new';
+ CHECKLOOP: while (1) {
+ for my $ext (@DB_EXTENSIONS) {
+ if (-e $name.$ext) {
+ warn "$name already exists (died expiry run?), please
clean up!";
+ $name .= $$;
+ next CHECKLOOP;
+ }
+ }
+ last CHECKLOOP;
+ }
and near the end:
# now rename in the new one. Try several extensions
for my $ext (@DB_EXTENSIONS) {
- my $newf = $path.'_toks.new'.$ext;
+ my $newf = $name.$ext;
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.