[spambayes-dev] race conditions in imap filtering?
Alon
arohter at nolar.com
Tue Sep 9 18:14:29 EDT 2003
Agreed. I only created the wrapper script after noticing two instances of
imapfilter running late one night. It's a hack, but with proper cron timing
it works. But this is much better done within spambayes itself, with more
fine-grain control, so users don't accidentally corrupt their data.
Opening an exclusive lock on a file when running should do the trick nicely.
aLoN
> wrapper script that creates a /var/lock/spambayes.lck before execution
>
> Creating such a file in a naive fashion creates a race condition. You
> might never get bitten by it, but any such code which goes into SpamBayes
> would have to use the proper mechanisms to create that file, otherwise
> someone will eventually run into it. If you create it with the low-level
> os.open() function and the proper flags (some combination of O_EXCL,
> O_WRONLY and O_EXCLOCK) you should be good to go on Unix, Windows or Mac
> OS X.
>
> Skip
>
More information about the spambayes-dev
mailing list