[Spambayes] [ spambayes-Bugs-741250 ] mboxtrain can truncate your mailbox

SourceForge.net noreply at sourceforge.net
Wed May 21 11:04:28 EDT 2003


Bugs item #741250, was opened at 2003-05-21 12:04
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=741250&group_id=61702

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Skip Montanaro (montanaro)
Summary: mboxtrain can truncate your mailbox

Initial Comment:
There is code in mboxtrain to rewrite the mailbox which looks like

    try:
        os.ftruncate(f.fileno(), 0)
        f.seek(0)
    except:
        # If anything goes wrong, don't try to write
        print "Problem truncating mbox--nothing written"
        raise

If the ftruncate() call succeeds but the seek() call fails, the user would
be left with an empty mailbox.  I think the code should write a 
temporary mailbox then rename it only if the complete write
operation is successful.  Furthermore, bare except clauses should
be avoided unless you really can't anticipate all the exceptions 
which might be raised.

No patch yet.  I'll try to come up with something.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=741250&group_id=61702



More information about the Spambayes mailing list