bf_compact
R Kimber
rkimber at ntlworld.com
Fri May 13 13:40:08 CEST 2005
On Thu, 12 May 2005 20:59:20 -0400
David Relson <relson at osagesoftware.com> wrote:
> The purpose of "bf_compact dir" is to compact the wordlist(s) in
> directory "dir". For database security, a new directory is created to
> hold the newly compacted wordlists. Once the compacting is done, the
> original directory, i.e. "dir", is renamed to "dir.old" and the new
> directory is renamed to "dir". A special check is included for file
> DB_CONFIG and it's copied to the new directory. Other files in "dir"
> are left unchanged, hence end up in "dir.old".
>
> Given the directory renaming, "bf_compact ." is problematical :-<
Maybe this is because the directory structure bogofilter uses isn't
optimal. Instead of working in the ~/.bogofilter directory, perhaps the
stuff should be in subdirectories of this. Thus one could have two
subdirectories: wordlist.active and wordlist.old
Then renaming directories is unnecessary. And bf_compact doesn't need
to have a directory (or indeed anything) as a parameter.
One might then have something like:
Have some reminder to shut down mail system, and exit if necessary
Read config file to find in which directory wordlist.db is placed and
whether transactional mode is used (better to read the config than
look for log files, logfiles might exist that are not actually being
used).
Set the path to this directory as bogofilter's 'home' path
Check to see whether a subdirectory of the home directory called
wordlist.old exists. If not create it (though this could actually be
done at installation).
Create $boghomepath/temp directory
Compact the active wordlist and send output to $boghomepath/temp
directory
Empty $boghomepath/wordlist.old
Then archive the files you want to keep to $boghomepath/wordlist.old
Load the compacted wordlist and any other stuff to $boghomepath/
wordlist.active
rm $boghomepath/temp
exit
No doubt there are reasons that I don't understand why it can't be like
this, but it seems to me that something along these lines would remove
any problematical features of bf_compact.
- Richard
--
Richard Kimber
http://www.psr.keele.ac.uk/
More information about the Bogofilter
mailing list