[spambayes-dev] race conditions in imap filtering?

Skip Montanaro skip at pobox.com
Tue Sep 9 16:12:49 EDT 2003


    aLoN> To solve the classifying vs.  training issue, I wrote a wrapper
    aLoN> script that creates a /var/lock/spambayes.lck before execution and
    aLoN> removes it when done.

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