<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span><br></span></div><div><br></div><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><br></font>On Mon, 2 May 2011 07:52:22 -0700 (PDT), chris coleman &lt;<a ymailto="mailto:christocoleman@yahoo.com" href="mailto:christocoleman@yahoo.com">christocoleman@yahoo.com</a>&gt; wrote:<br>&gt; Thanks Sebastian and Nicolas.<br>&gt; <br>&gt; The corrupt data has been found.<br>&gt; <br>&gt; You're right it was indeed in the huge file ~/.offlineimap/Repository-IMAPLocal&lt;username&gt;/UIDMapping/INBOX.Sent&nbsp; <br>&gt; <br>&gt; Here are a few lines before and after :<br>&gt; 16731:4777<br>&gt; 16732:4778<br>&gt; 16733:4779<br>&gt; 16734:&nbsp; P &nbsp;&nbsp; 35:4781<br>&gt;
 16736:4782<br>&gt; 16737:4783<br>&gt; 16738:4784<br>&gt; They're consecutive UIDs so I re-entered them and filled in the missing numbers in the sequence.<br>&gt; <br>&gt; With the INBOX.Sent file repaired in this user, I re-ran it, and we're down to this same basic error on both mailboxes:<br>&gt; <br>&gt; <br>&gt; "WARNING: ERROR in syncfolder for username1: null byte in argument for long()"<br>&gt; "WARNING: ERROR in syncfolder for username2: null byte in argument for long()"<br>&gt; <br>&gt; <br>&gt; Do you have a patch for this "ERROR in syncfolder", to pinpoint the line number and filename ?<br><br>The error most likely occurs in offlineimap/offlineimap/folder/IMAP.py<br>around line 162 in the cachemessagelist() function<br><br>What happens is that we select a folder in line 111 in:<br><br>imaptype, imapdata = imapobj.select(self.getfullname(), readonly = 1, force = 1)<br><br>and later in line 162 we go through the returned data, trying to get
 the<br>highest UID number that the select call returned:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for msgid in imapdata:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxmsgid = max(long(msgid), maxmsgid)<br><br>If you could add some debug code in the form<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for msgid in imapdata:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxmsgid = max(long(msgid), maxmsgid)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise Exception(str(imapdata))<br><br>and let us see what exactly had been returned in imapdata we could try<br>to work this out.<br><br>Let me know if you need more help in making the code changes. I
 hope we<br>get this one nailed down.<br><br>Sebastian<br><br>============<br><br>I'm on 6.3.2-0 because it's the highest that will run on debian 5.0 (lenny).<br><br>The catch is, 6.3.2-0 code for offlineimap/offlineimap/folder/IMAP.py is using imapobj not imapdata - so it seems like your patch would need modification to fit.<br><br>Here is the code excerpted from lines 175-188:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 1. Some mail servers do not return an EXISTS response<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # if the folder is empty.&nbsp; 2. ZIMBRA servers can return<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # multiple
 EXISTS replies in the form 500, 1000, 1500,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 1623 so check for potentially multiple replies.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxmsgid = 0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for msgid in imapobj.untagged_responses['EXISTS']:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxmsgid = max(long(msgid), maxmsgid)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; messagesToFetch = '1:%d' % maxmsgid;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except
 KeyError:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if maxmsgid &lt; 1:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #no messages; return<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return<br><br>Your suggestion on how to patch this ?<br><br>Chris<br><br></div></div></div></body></html>