<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"><b><span style="font-weight:bold;"></span></b></font><div id="yiv1076030130"><div style="color:#000;background-color:#fff;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;"><div style="font-family:times new roman, new york, times, serif;font-size:12pt;"><font face="Arial" size="2"><br></font>&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></div></div></div></div><br>---------------------------------------------------------------<br><br>Sebastian, Nicolas,<br><br>I went ahead with your suggestion and patched those lines (in version 6.3.2-0&nbsp; folder/IMAP.py ) by wrapping it with the try catch bock.<br><br>Running it triggered a recompile.&nbsp; <br><br>But it didn't output any further details on the filename/line number
 where any bad data is.&nbsp; <br><br>Here's the patch just FYI, from line 174:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:<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; try:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #new<br>&nbsp;&nbsp;&nbsp;&nbsp;&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;&nb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p;&nbsp;&nbsp;&nbsp;&nbsp; return<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Now, get the flags and UIDs for these.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # We could conceivably get rid of maxmsgid and just say<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # '1:*' here.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; response = imapobj.fetch(messagesToFetch, '(FLAGS UID)')[1]<br><br>Must get better info on where the bad data is located, and repair these 2 username's data, ASAP.<br><br>I see the actual error message gets output in the file offlineimap/accounts.py, function syncfolder, line 380:<br>&nbsp;&nbsp;&nbsp; except:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ui.warn("ERROR in syncfolder for %s folder %s: %s" %
 \<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (accountname,remotefolder.getvisiblename(),sys.exc_info()[1]))<br><br>These are available: localrepos, localfolder, remoterepos, remotefolder.&nbsp; <br><br>How about we output details of the line number and filename right here in the call to ui.warn ????<br><br>Chris<br><br></div></div></div></body></html>