This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author petri.lehtinen
Recipients barry, petri.lehtinen, r.david.murray
Date 2012-09-09.10:50:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347187835.32.0.706272048154.issue15122@psf.upfronthosting.co.za>
In-reply-to
Content
Attaching a patch that changes all single-file mailboxes to be rewritten in-place instead of rewriting and renaming. The patch doesn't add an option, because IMO this should be the default behavior.

In addition to solving the locking problems, this makes it significantly faster and less disk space consuming to remove or replace messages in very large mailbox files, because the whole mailbox is not rewritten.

With this patch, the code now writes messages to a temporary file, starting from the first changed message to the end of the mailbox file. After this, the contents of the temporary file are copied back to the mailbox file and the mailbox file is truncated to the correct length.

Care is taken that the process can be restarted if a crash (e.g. KeyboardInterrupt) occurs before starting to copy the changes back to the mailbox file, by altering self._toc and self._pending at the right moment.

I'm not sure whether this would be a bug fix or a new feature. Suggestions?
History
Date User Action Args
2012-09-09 10:50:35petri.lehtinensetrecipients: + petri.lehtinen, barry, r.david.murray
2012-09-09 10:50:35petri.lehtinensetmessageid: <1347187835.32.0.706272048154.issue15122@psf.upfronthosting.co.za>
2012-09-09 10:50:34petri.lehtinenlinkissue15122 messages
2012-09-09 10:50:33petri.lehtinencreate