Thanks for the help debugging this, James! I believe I have isolated the
problem.
I have attached a diff below, or you can download it from
http://git.complete.org/offlineimap?a=commitdiff_plain;h=db805043f2d3ccf59cb7d167cd917d178a16e540
I tried to document the situation in the commit log (which is included in the
diff). A small excerpt here:
looking at code for Gmail.py processmessagesflags, comments from Ricardo
indicate it was copied from the same function in folder/IMAP.py.
However, folder/IMAP.py has checks for this, added 2002-07-12 in
5342dacc & 817a10ce. Suspect that Gmail author believed those checks
superfluous for Gmail.
Riccardo, do you believe I've done the right thing here?
James, please apply this patch and run it for a bit and let me know if it
fixes your problem.
Thanks,
-- John
commit db805043f2d3ccf59cb7d167cd917d178a16e540
Author: John Goerzen <[EMAIL PROTECTED]>
Date: Sat Mar 8 07:47:53 2008 -0600
Attempt to fix a crashing bug in Gmail driver
refs deb#469598
Bug report received in Debian. User is having occasional trouble with Gmail
driver crashing, indicates problem may have started after switching to Gmail.
Gmail driver merged to tree in 81b86fb74 on 2008-01-03 and recently released
in beta tarballs.
BT shows:
File "/var/lib/python-support/python2.4/offlineimap/folder/Gmail.py", line 102, in processmessagesflags
attributehash = imaputil.flags2hash(imaputil.imapsplit(result)[1])
File "/var/lib/python-support/python2.4/offlineimap/imaputil.py", line 88, in imapsplit
for i in range(len(imapstring)):
TypeError: len() of unsized object
imap debug log shows:
imap: 29:58.16 > BEAL75 UID STORE 4887 +FLAGS (\Deleted)
imap: 29:58.47 < BEAL75 OK Success
imap: 29:58.47 matched r'(?P<tag>BEAL\d+) (?P<type>[A-Z]+) (?P<data>.*)' => ('BEAL75', 'OK', 'Success')
imap: imapsplit() called with input: None
imap: imapsplit() got a non-string input; working around.
looking at code for Gmail.py processmessagesflags, comments from Ricardo
indicate it was copied from the same function in folder/IMAP.py.
However, folder/IMAP.py has checks for this, added 2002-07-12 in
5342dacc & 817a10ce. Suspect that Gmail author believed those checks
superfluous for Gmail.
Copied checks from folder/IMAP.py to folder/Gmail.py.
diff --git a/offlineimap/folder/Gmail.py b/offlineimap/folder/Gmail.py
index bf040e9..48460d9 100644
--- a/offlineimap/folder/Gmail.py
+++ b/offlineimap/folder/Gmail.py
@@ -99,7 +99,14 @@ class GmailFolder(IMAPFolder):
needupdate = copy(uidlist)
for result in r:
+ if result == None:
+ # Compensate for servers that don't return anything from
+ # STORE.
+ continue
attributehash = imaputil.flags2hash(imaputil.imapsplit(result)[1])
+ if not ('UID' in attributehash and 'FLAGS' in attributehash):
+ # Compensate for servers that don't return a UID attribute.
+ continue
flags = attributehash['FLAGS']
uid = long(attributehash['UID'])
self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(flags)