Bogofilter and reclassifying

Stroller Linux.Luser at myrealbox.com
Fri Dec 5 20:05:24 CET 2003


Whups! Clicked send on that one too early! My aploogies.


On Dec 5, 2003, at 12:59 pm, David Relson wrote:
>
> I took a quick look at your script and it looks fine.  It's nicely
> readable and looks like it should work.  Good job.

Thanks! It's my first real Bash script.   8-]

I fooled with a the `find` command a little whilst implementing it, and 
was interested to discover that the `find ... -print0 | xargs -0 
bogofilter -B` method I used (or rather, was advised to use!) was 
*twenty times faster* than `find ...`-exec bogofilter -I`!! [1]

> I did find a couple of details that you might want to change.  First,
> "-W" isn't needed as that's bogofilter's default mode....
> Lastly, the "exit 0" statements are unnecessary as they're
> in places where nothing more happens in the script.  If they're 
> deleted,
> the code will just fall through to the end of the script and exit
> normally.

This is sorta characteristic of my programming style - I'll often tend 
to write things in my code (previously I've used Pascal, C & a little 
Java) which may be a little bit redundant, but which may make it a 
little more human-readable. So, if nothing else, the exit 0 (which I 
think is correct for a script which has executed cleanly?) tells anyone 
wishing to modify it that that's where the script is supposed to end. 
Calling something explicitly in its default mode saves anyone looking 
up what the default mode is - my .mailfilter script calls bogofilter 
with the "-p -f" flags, too.

I don't really know if this is good practice or not - it's just the way 
I do it & would be keen to find myself corrected if appropriate.

>  Second, since
> bogofilter doesn't presently care whether its running with combined or
> separate wordlists, those checks aren't necessary.  Of course the
> separate wordlist code is scheduled to be deprecated in 0.16.0 and
> removed in 0.17.0 so using a single, combined wordlist is the right
> thing to do.

Ah, yes. This is because my original intention was to have the `find 
-newer`called upon ~/.bogofilter/wordlist.db; I don't really think the 
bogoupdate.lastrun touchfile should be necessary, but I don't know how 
to avoid it. Bogofilter will change the file-modification date as soon 
as it parses the first email, so the only way would be to load the last 
modification time of wordlist.db when the script starts up, store it as 
a variable & have find compare with that, but I don't really know how 
to do that.

Thanks for your help & advice,

Stroller.


[1] I added that extra ! for the benefit of Boris & hopes he fins it an 
interesting token.





More information about the Bogofilter mailing list