aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Drop .py extension from the unittest scriptNikolaus Schulz2010-07-295-4/+4
|
* Bump version to 0.8.0Nikolaus Schulz2010-07-293-3/+3
|
* Updated changelog, which was very outdatedNikolaus Schulz2010-07-291-17/+41
|
* Updated copyright yearNikolaus Schulz2010-07-292-3/+3
|
* Updated TODO, dropping a lot of obsolete itemsNikolaus Schulz2010-07-292-23/+0
| | | | | | | | | | | Notable items that are now resolved or implemented: * archives are now locked * the mbox classes have been refactored to a cleaner design * we moved from flock locking to fcntl * the setuid() feature is long gone * symlink attacks for tempfiles are not possible (that is really an ancient TODO item from the original author) * the test suite now has a lot of maildir test cases
* test suite: add more maildir test casesNikolaus Schulz2010-07-291-18/+187
| | | | Maildir testing should now be roughly on par with mbox testing.
* test suite: remove unused remove() methods from maildir classesNikolaus Schulz2010-07-291-17/+0
| | | | | For cleanup of temporary files, we lean on shutil.rmtree anyway, so don't bother wasting more code on this.
* test suite: remove incomplete MH testing codeNikolaus Schulz2010-07-291-32/+1
| | | | | | | | | | I just discovered that archivemails MH support is broken with respect to message flags, and in my opinion it doesn't make much sense to test known-broken functionality. In fact there may well be zero archivemail users with MH mailboxes; MH is basically an obsolete format, and any archivemail user with MH mailboxes would probably have complained about lost message flags.
* test suite: first shot at implementing maildir test casesNikolaus Schulz2010-07-291-3/+387
|
* test suite: remove obsolete $Id$ subversion keywordNikolaus Schulz2010-07-291-1/+0
|
* test suite: cleanup of the mbox testing codeNikolaus Schulz2010-07-291-52/+56
| | | | | | This code is complex, too complex actually. Rename some methods and variables, rework some code and and add some explaining comments in order to make it it least a bit easier to understand.
* test suite: remove obsolete test that we preserve mbox file modesNikolaus Schulz2010-07-291-38/+0
| | | | | This test case is obsolete since we no longer replace the mbox file with a new copy but rewrite it.
* Fix TempMbox.saveas() to unregister the right file from _staleNikolaus Schulz2010-07-281-1/+1
|
* Python language fix: replace C-style boolean values "1" and "0" with True/FalseNikolaus Schulz2010-07-192-100/+100
|
* Remove unused variableNikolaus Schulz2010-07-191-1/+0
|
* Python language fix: remove parentheses around asserted expressionsNikolaus Schulz2010-07-192-95/+95
| | | | assert is not a function.
* Add a note about the race window when resetting an mbox file timestampNikolaus Schulz2010-07-191-1/+1
|
* TODO: new items: make IMAP test suite with no network I/O; drop .py extensionNikolaus Schulz2010-07-191-1/+5
|
* Warn if the temporary directory is not empty on cleanupNikolaus Schulz2010-07-191-2/+7
|
* When creating a dotlock, register it slightly earlier for cleanupNikolaus Schulz2010-07-191-1/+1
| | | | | This closes a very unlikely window where we could create a dotlock file, but then encounter an error and fail to clean up the dotlock.
* In verbose mode, say that we're about to dotlock an mbox before trying to do soNikolaus Schulz2010-07-191-1/+2
|
* Minor docstring/whitespace fixesNikolaus Schulz2010-07-191-3/+4
|
* At critical points, flush mbox files and sync them to diskNikolaus Schulz2010-07-191-3/+30
| | | | | | This should minimize the risk of data loss. Flushing a locked mbox file before unlocking it also ensures that there's no window when another process could lock the mbox after us, but still see the old content.
* Further refactoring of the mbox classes, adding archive locking supportNikolaus Schulz2010-07-191-46/+58
| | | | | | The mbox locking methods move into a new class LockableMboxMixin, and the Mbox and ArchiveMbox classes become subclasses of LockableMboxMixin. class StaleFiles is updated to handle multiple dotlock files.
* Fail as gracefully as possible if writing out the new mailboxes failsNikolaus Schulz2010-07-191-5/+35
| | | | | | | | | | In particular: * If writing the archived messages to the final archive fails, try to restore the archive and abort (by not handling the exception). This is possible since we first save the archive, and only then the modified mailbox, so we don't corrupt the original mbox in this case. * If writing a modified mbox file fails, save the temporary copy.
* Refactoring of the mbox classesNikolaus Schulz2010-07-191-133/+82
| | | | | | | | | | | | | | | | | | | | | | | The RetainMbox and ArchiveMbox classes are now gone, mainly because their finalise() methods were messing with the archived mbox and the archive, respectively, which was not good OO design. The core functionality of the finalise() methods of both removed classes is moved to the objects that are manipulated: the Mbox class representing the mbox that is being archived gains a new method overwrite_with(), and there is a new class ArchiveMbox that represents the actual archive, which has an append() method (yes, unfortunately the new class has the same name like the removed class). The RetainMbox instance is replaced with a TempMbox, and the ArchiveMbox instance either with a TempMbox, or a CompressedTempMbox if archive compression is enabled. Finally, a compressed TempMbox is now a implemented as a subclass of TempMbox, named CompressedMbox. Cooperation with the StaleFiles class moves into the TempMbox class. This means slightly less detailed verbose cleanup reporting, oh well.
* Use safe methods to open the archive mbox and an existing mbox fileNikolaus Schulz2010-07-191-8/+57
|
* mbox locking: omit dotlock if we don't have the permissions to create itNikolaus Schulz2010-07-192-2/+21
| | | | Closes: issue #855269.
* mbox locking: combine locking functions into one and swap lock orderNikolaus Schulz2010-07-192-39/+69
| | | | | | | | | | | | | We used to create a dotlock file first and then lock with fcntl; swap that order, since locking first with fcntl seems to be more common. This patch also adds general mbox lock/unlock methods, which call the dotlock and fcntl-lock methods, and moves the retry logic there. When the dotlock and fcntl methods fail to acquire a lock, they now raise a custom exception "LockUnavailable", which gets caught in the general lock() method. That way, if we succeed to acquire one lock but fail to acquire the other, we can release our locks at the upper level and retry.
* Switch mbox locking from flock(2) to posix lockf(2)Nikolaus Schulz2010-07-195-35/+24
| | | | flock() locks aren't portable; lockf() locks are.
* Rename procmail_lock->dotlock_lockNikolaus Schulz2010-07-192-23/+23
| | | | | An entirely cosmetic variable rename, but it's just not correct to call this a "procmail lock". Also reword some comments accordingly.
* test suite: use common base class with helper methods for mbox testingNikolaus Schulz2010-07-191-216/+168
| | | | | | | | These helper methods provide success verification after test archiving runs, and test case setup. This is a tradeoff: because these methods need to support all scenarios in one place, they introduce some new complexity - but they replace a lot of tedious, very similar, but still not entirely identical code all over the place.
* test suite: cut down the test of the --all optionNikolaus Schulz2010-07-191-19/+9
| | | | | Don't do entire test archiving runs, just call archivemail.should_archive().
* test suite: cut down the test of the --preserve-unread optionNikolaus Schulz2010-07-191-21/+8
| | | | | Don't do entire test archiving runs, just call archivemail.should_archive().
* test suite: change misleading test case nameNikolaus Schulz2010-07-191-3/+3
| | | | | | TestArchiveMboxPreserveStatus actually doesn't test that the message status is preserved, but that the --preserve-unread option works. Rename it to TestArchiveMboxPreserveUnread.
* test suite: cut down the test of the --size optionNikolaus Schulz2010-07-191-22/+9
| | | | | Don't do entire test archiving runs, just call archivemail.should_archive().
* test suite: cut down the test of --output-dirNikolaus Schulz2010-07-191-14/+5
| | | | | Don't do entire test archiving runs, just call archivemail.make_archive_name() and verify the result.
* test suite: cut down testing the handling of flagged messagesNikolaus Schulz2010-07-191-29/+10
| | | | | Don't do entire test archiving runs, just call archivemail.should_archive().
* test suite: remove duplicate test case for --date optionNikolaus Schulz2010-07-191-35/+0
|
* test suite: cut down archive suffix generation testingNikolaus Schulz2010-07-191-17/+8
| | | | | Don't do entire test archiving runs, just call archivemail.make_archive_name() and verify the result.
* test suite: test weird message headers in one runNikolaus Schulz2010-07-191-8/+12
| | | | Before, every test header was tested in a separate archiving run.
* test suite: cut down the test of date header processingNikolaus Schulz2010-07-191-15/+3
| | | | | Don't do entire test archiving runs, just call archivemail.should_archive().
* test suite: let make_message() optionally return a rfc822.MessageNikolaus Schulz2010-07-191-3/+7
|
* Remove lots of redundant test runs from the test suiteNikolaus Schulz2010-07-191-615/+347
| | | | | | | | | | | The test suite used to run a lot of triple tests, by first calling archivemail.archive() directly, and then running the entire archivemail script twice, once with long and once with short options. But we already test option processing seperately, and beyond that, archivemail.main() essentially just calls archive() for each mailbox in turn. So we just drop all runs of the entire archivemail script from the test suite, giving it a huge speed boost (on my old iBook, running the test suite drops from 73 to 5 seconds).
* Test suite: test command line option processingNikolaus Schulz2010-07-191-0/+88
|
* test suite: eliminate remaining call of external gzip programNikolaus Schulz2010-07-191-4/+6
| | | | Use gzip.GzipFile instead.
* test suite: define and use assertEqualContent() to compare filesNikolaus Schulz2010-07-191-114/+60
| | | | | This eliminates a lot of copy-and-paste code, and switches from os.system("gzip <...>") to gzip.GzipFile.
* test suite: account for lacking precision of os.utime()Nikolaus Schulz2010-07-191-6/+9
| | | | | | | os.utime() uses the utimes(2) system call to set file timestamps. utimes(2) has a microsecond resolution, but stat(2) may return timestamps with nanosecond resolution. So, the check that we have properly reset the mbox file timestamp must allow a minor deviation.
* Fix minor race when deleting messages in a maildir/mh boxNikolaus Schulz2010-07-191-3/+4
| | | | | Nothing serious, but if another client deleted it in the small window after we checked it, we would have crashed trying to delete a non-existing file.
* Simplify the final committing of the mailbox and archiveNikolaus Schulz2010-07-192-83/+54
| | | | | | | | | | * Make the finalise() methods spot if they have anything to do * We used to create the temporary mbox files on demand in the message processing loop, if we needed to write to them. Now we create them beforehand, but only if they might be needed (e.g. we don't create an archive if options.delete_old_mail is set). * The above combined makes the final committing of the changes simpler (a *lot* simpler for mboxes), and we can dump the Mbox.leave_empty() method.