maxage causes loss of local email

Nicolas Sebrecht nicolas.s-dev at laposte.net
Sat Mar 21 20:14:05 GMT 2015


On Sat, Mar 21, 2015 at 12:35:32PM -0400, Janna Martl wrote:
> On Sat, Mar 21, 2015 at 12:49:35PM +0100, Nicolas Sebrecht wrote:
> >On Sat, Mar 21, 2015 at 02:14:08AM -0400, Janna Martl wrote:
> >
> >> I realized where (some of) my date-mismatched messages were coming from:
> >> if you increase maxage, then some local messages get re-copied to
> >> remote (i.e. the ones from ~ maxage days ago), they're assigned (new)
> >> UIDs. This is bad because, a day or so later, these messages are in
> >> the remote messagelist (new UID) but not in the local messagelist (old
> >> date), so they get deleted locally.
>                               ^remotely
> 
> >In the worse case this should be documented but this should not happen
> >anymore with the latter fix about timezones.
> 
> No, it does still happen; it's not caused by timezone issues, but
> rather by the way the timezone fix works. The problem is basically
> that the remote messagelist contains all messages with UID > min_uid,
> but the local messagelist contains messages that have UID > min_uid
> *and also* are newer than maxage. In the above case, we've got a
> message that fulfills the first, but not second, condition.

Unless I'm mistaken, "messages newer than maxage" are not due to maxage
being increased but because the date put into the local filename might
not match the remote INTERNALDATE of the message. IOW, we have

 (remote) UID X -> INTERNALDATE D1
 (local ) UID X -> filename date D2

The mistake is that we cannot guarantee that the local date D2 match D1.

I can't think of a use case where we couldn't do something like that:

for dirannex, filename in files:
    if min_uid:
        assert maxage == None
        # Case when we have a min_uid. Filter with UIDs >= min_uid only.
        # This will ignore "newer" mails whatever their UID, they don't
        # fit the maxage restriction (limit defined by the remote).
    if maxage:
        assert min_uid == None
        # Case when we couldn't get a min_uid while applying maxage on
        # remote. This filter "mimic" the IMAP SEARCH command with
        # maxage restriction. We rely on the date encoded into the
        # filname. We'll try to find the lowest UID from this list since
        # it's the best we can do.


-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list