Bugreport: maxage deleting old email from destination

Ivan Semin ivun at wirebyte.com
Thu Jul 28 12:22:26 BST 2011


Hello!

My apologize to Philipp Kern for spoiling his bug report topic,
because my bug is probably a different one (although I get a similar
error too).

I have prepared a more detailed bug report.

So again, what I am doing.

1. Updated offlineimap to next branch (6.3.4-rc3). The file was
nicolas33-offlineimap-v6.3.4-rc3-5-g5db1633.tar.gz

2. Setting up the sync:

[Account Data]
localrepository = DataBackup
remoterepository = DataLocal
#sorry for the name, local is really remote gmail :)

[Repository DataLocal]
type = Gmail
remotehost = imap.gmail.com
remoteuser =
remotepass =
remoteport = 993
ssl = yes
maxconnections = 1
realdelete = no
nametrans = lambda folder: re.sub('.*Trash$', 'Trash', folder)
folderfilter = lambda foldername: foldername not in ['[Gmail]/All
Mail','[Gmail]/Sent Messages','[Gmail]/Starred','[Gmail]/Trash']
readonly = yes

[Repository DataBackup]
type = IMAP
remotehost = 127.0.0.1
remoteuser =
remotepass =
realdelete = no

3. Run the sync. It needed a dozen of runs, because it sometimes fail
in the middle of the sync with something like

WARNING: ERROR attempting to copy message 361 for account
Data:Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/Base.py",
line 250, in copymessageto
    message = self.getmessage(uid)
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/IMAP.py",
line 215, in getmessage
    raise OfflineImapError(reason, severity)
OfflineImapError: IMAP server 'DataLocal' responded with 'NO' to
fetching message UID '361'

Although I am used to it, so I just rerun and finally I have all my
mail downloaded.

4. I also created a new gmail folder and copied a very old message
there. Now, after the sync I delete that message and ensure it is
deleted during the next sync. This works fine. I restore the message
and offlineimap finds that. Fine.

5. Now I set maxage=90. My message should be ignored now, because it's
more than 8 months old. Now I get a number of error messages (2 per
imap folder I think)

WARNING: ERROR attempting to sync flags for account Data:Traceback
(most recent call last):
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/Base.py",
line 413, in syncmessagesto
    action(dstfolder, statusfolder)
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/Base.py",
line 329, in syncmessagesto_delete
    folder.deletemessages(deletelist)
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/UIDMaps.py",
line 253, in deletemessages
    self._mb.deletemessages(self._uidlist(self.r2l, uidlist))
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/UIDMaps.py",
line 87, in _uidlist
    return [mapping[x] for x in items]
KeyError: 1L

WARNING: ERROR in syncfolder for Data folder Products Updates/Done:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/offlineimap/accounts.py",
line 347, in syncfolder
    remotefolder.syncmessagesto(localfolder, statusfolder)
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/Base.py",
line 413, in syncmessagesto
    action(dstfolder, statusfolder)
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/Base.py",
line 329, in syncmessagesto_delete
    folder.deletemessages(deletelist)
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/UIDMaps.py",
line 253, in deletemessages
    self._mb.deletemessages(self._uidlist(self.r2l, uidlist))
  File "/usr/lib/python2.6/site-packages/offlineimap/folder/UIDMaps.py",
line 87, in _uidlist
    return [mapping[x] for x in items]
KeyError: 1L


It also deletes old messages from the destination.

Syncing INBOX: Gmail -> MappedIMAP
Deleting 3165 messages (4, 5, 6, 8, 9, 11 ............. 4053, 8910,
8912, 9731) in MappedIMAP[INBOX]
Syncing Ivantest: Gmail -> MappedIMAP
Deleting 1 messages (3) in MappedIMAP[Ivantest]

My test message was also deleted, although I didn't delete it from the source.

6. I run the sync again. It syncronizes the updates to new emails,
fine. The old messages are still absent from the destination.

7. I remove maxage=90.

8. It starts downloading all messages it deleted earlier.

Syncing INBOX: Gmail -> MappedIMAP
Copy message 4 Gmail[INBOX] -> MappedIMAP[INBOX]
Copy message 5 Gmail[INBOX] -> MappedIMAP[INBOX]
Copy message 6 Gmail[INBOX] -> MappedIMAP[INBOX]
Copy message 8 Gmail[INBOX] -> MappedIMAP[INBOX]
Copy message 9 Gmail[INBOX] -> MappedIMAP[INBOX]
Copy message 11 Gmail[INBOX] -> MappedIMAP[INBOX]
Copy message 12 Gmail[INBOX] -> MappedIMAP[INBOX]
...


The purpose of this setup was to backup email. I would like it run it
weekly so that I can delete the old mail from gmail after that
(because we are close to gmail limit). We seldom need old email, but
would be nice to have that in a separate mailbox.




More information about the OfflineIMAP-project mailing list