docker-offlineimap/offlineimap/folder
Sebastian Spaeth 8fc7227189 SEVERE: Fix getting wrong UID back on IMAP upload
This change looks harmless, but it fixes a severe bugfix, potentially
leading to data loss! It fixes the "on n new uploads, it will redownload
n-1, n-2, n-3,... messages during the next syncs" condition, and this is
what happens:

If there are more than one Mails to upload to a server, we do that by
repeatedly invoking folder.IMAP.savemessage(). If the server supports
the UIDPLUS extension we query the resulting UID by doing a:

imapobj._get_untagged_response('APPENDUID', True)

and that is exactly the problem. The "True" part causes the reply to
remain in the "response stack" of the imaplib2 library. When we do
the same call on a subsequent message and the connection is still on the
same folder, we will get the same UID response back (imaplib2 only looks
for the first matching response and returns that). The only time we
clear the response stack, is when the IMAP connection SELECTS a
different folder.

This means that when we upload 10 messages, the IMAP server gives us
always the same UID (that of the first one) back. And trying to write
out 10 different messages with the same UID will confuse OfflineIMAP.

This is the reason why we saw the ongoing UPLOADING/DOWNLOADING behavior
that people reported. And this is the reason why we saw the
inconsistency in the UID mapping in the IMAP<->IMAP case.

I urge everyone to upgrade ASAP. Sorry for that, I don't know why the
problem only became prevalent in the recent few releases as this code
has been there for quite a while.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-01-06 21:57:48 +01:00
..
__init__.py Add Gmail IMAP special support. 2008-01-03 04:56:55 +01:00
Base.py Forgot to change a variable name in all cases 2012-01-06 21:41:04 +01:00
Gmail.py Remove visiblename as parameter to IMAPFolder creation 2011-09-16 12:54:29 +02:00
IMAP.py SEVERE: Fix getting wrong UID back on IMAP upload 2012-01-06 21:57:48 +01:00
LocalStatus.py WIP, revamp how we treat top-level dirs 2012-01-06 19:08:48 +01:00
LocalStatusSQLite.py Don't pass in 'root' as para to LocalStatusFolders 2011-09-16 12:54:12 +02:00
Maildir.py WIP, revamp how we treat top-level dirs 2012-01-06 19:08:48 +01:00
UIDMaps.py Implement change_message_uid 2012-01-06 19:08:48 +01:00