| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Closes: issue #855269.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
flock() locks aren't portable; lockf() locks are.
|
|
|
|
|
| |
An entirely cosmetic variable rename, but it's just not correct to call
this a "procmail lock". Also reword some comments accordingly.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
This separates write-only mbox access to the temporary mboxes from the read-only
access to the original mbox.
|
| |
|
|
|
|
|
| |
This is WIP to prepare locking for the archive. Since we no longer copy the
whole archive before appending, archiving should also be faster.
|
| |
|
|
|
|
|
|
| |
When committing a changed mbox, don't use os.rename(), and don't open/close
the mbox file to truncate it to zero length. Locking was pretty much broken
before -- at least in theory a quite severe bug.
|
|
|
|
|
|
|
|
| |
* Remove code duplication: restore the mbox timestamps once and for all when
we're done
* Don't bother restoring the file mode when finishing, since this is handled in
RetainMbox.finalise() (and need be)
* Therefore, rename Mbox.reset_stat() to reset_timestamps()
|
|
|
|
|
| |
This is now before we do the sanity checking, so in verbose mode, we don't error
out before having said that we now turn attention to the current mailbox.
|
|
|
|
|
|
| |
This should also protect people relying on the old setuid feature.
If the mailbox is local, by checking the ownership we necessarily check for
existance.
|
|
|
|
|
| |
This used to happen when creating the temporary archive, we now do it before we
start processing the mailbox.
|
|
|
|
|
| |
Remove the checks if the mailbox is a symlink, and if the output directory is
world-writable. Better no security than half-baked security.
|
| |
|
|
|
|
| |
It was not a good idea, and trying to do it right would be too much effort.
|
|
|
|
|
|
| |
I don't think anybody wants to archive folders in shared or public IMAP
namespaces, so we don't bother checking all possible namespaces. The code was
ugly anyway.
|
|
|
|
|
|
| |
archivemail development has moved to git. This patch updates the project
webpage, removes the subversion $Id$ keyword that was stored in
archivemail.__svn_id__, and updates the Makefile.
|
|
|
|
|
|
| |
Only replace the slash with the server's hierarchy delimiter if the latter
actually exists (is not NIL).
|
|
|
|
|
| |
This spewed an error when --dry-running.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* Automatically add NAMESPACE prefix to the mailbox path if necessary,
* Explicitely check for guessed mailbox names with LIST instead of just trying
to SELECT them.
* Updated documentation about NAMESPACE handling.
|
|
|
|
|
| |
No code changes, just moved functions around.
|
|
|
|
|
| |
for it, which was just used to spit a special error message anyway.
|
|
|
|
|
|
| |
The message sequence numbers must be strings, but were generated as integers;
fixed.
|
| |
|
| |
|
|
|
|
|
|
| |
Updated documentation, and added a first simple unittest for this.
Closes: #1764846.
|
| |
|
|
|
|
|
|
| |
The incompatible changes in mailbox.Maildir triggered an assertion in
_archive_dir(); removing that assertion since it looks not useful anyway.
|
|
|
|
|
| |
expressions.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Fixed.
|
|
|
|
|
|
|
|
|
| |
* look for the timestamp of the latest 'Received' header before resorting to
'Date' or 'Resent-Date'.
* let 'Resent-date' header take precedence over 'Date'.
Document these changes in manpage and changelog.
Closes: #1481316, #1764855, Debian bug #272666.
|
|
|
|
|
|
| |
writing From_ line timestamps, don't use UTC but local time, without timezone
information.
|