classification
Title: mailbox.mbox creates new file when adding message to mbox
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.2, Python 3.1, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: akuchling, chrisisbd
Priority: normal Keywords:

Created on 2010-08-10 16:40 by chrisisbd, last changed 2010-08-10 19:01 by r.david.murray.

Messages (1)
msg113547 - (view) Author: Chris Green (chrisisbd) Date: 2010-08-10 16:40
When you call mailbox.mbox.add() the old mbox file is copied, the new file is modified and then renamed to the name of the'old' mbox file.

This breaks the way that many MUAs detect and manage new mail in an mbox, in particular I discovered this with mutt.  If the python process writing the mbox and mutt are on the same system writing a local file then you get the message "Mailbox was externally modified. Flags may be wrong." from mutt (and various odd things can happen).  If mutt is reading the mbox over NFS then you get a "Stale NFS file handle" error.

This should be strongly noted in the documentation for mailbox.mbox, in addition it would be really nice if there was a mailbox.mbox.append() method which *really* appends the data to the end of the mbox rather than changing it completely.

Most MDAs (all?) do just append new mail to the end of the mbox and I feel that python should really try and do the same.
History
Date User Action Args
2010-08-10 19:01:12r.david.murraysetnosy: + akuchling

versions: + Python 3.1, Python 3.2
2010-08-10 16:40:07chrisisbdcreate