[PATCH] More detailed error output on corrupt UID mapping files

chris coleman christocoleman at yahoo.com
Tue May 3 16:07:43 BST 2011

On Tue, 3 May 2011 04:30:51 -0700 (PDT), chris coleman wrote:

> But it didn't output any further details on the filename/line number where any bad data is.  

No, because there is no bad filename/line number as the bad data is
coming in the form of a reply from the IMAP server.

> Must get better info on where the bad data is located, and repair these 2 username's data, ASAP.

The bad data is either a bad email or a bad reply from the IMAP server
that we cannot cope with. Therefore it would be good to know *what* that
IMAP reply is.

> I see the actual error message gets output in the file offlineimap/accounts.py, function syncfolder, line 380:
>     except:
>         ui.warn("ERROR in syncfolder for %s folder %s: %s" % \
>                 (accountname,remotefolder.getvisiblename(),sys.exc_info()[1]))
> These are available: localrepos, localfolder, remoterepos, remotefolder.  
> How about we output details of the line number and filename right here in the call to ui.warn ????

6.3.3 outputs more information, giving us the full traceback (ie in
which line the call failed). However that won't help you here, as we
know that it fails in that one "long()" call. It's just triggered from a
specific reply from the IMAP server. And as we have changed the code
From 6.3.2 to 6.3.3, I think it would be worthwhile checking it out.

It's as easy as downloading and untaring

going into the directory and issueing "python offlineimap.py" in
there. No installation required.




1) I ran 6.3.3.  Same results:

This is OfflineIMAP 6.3.3
Python: 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) 
[GCC 4.3.2]
Platform: linux2
Args: ['./offlineimap.py', '-1', '-a', '<username1>', '-l', 'output.log.2011-05-03.txt']
WARNING: ERROR in syncfolder for <username1> folder INBOX: Traceback (most recent call last):
  File "/root/nicolas33-offlineimap-v633/offlineimap/accounts.py", line 313, in syncfolder
  File "/root/nicolas33-offlineimap-v633/offlineimap/folder/LocalStatus.py", line 82, in cachemessagelist
    uid = long(uid)
ValueError: null byte in argument for long()

2) I looked around online for this error "null byte in argument for long()". I found this page:


It's possibly a bug in python since 2.6a0 Jan 2007 (and my debian lenny is running 2.5.2).

>> > > >>> long('123\0') >> > > Traceback (most recent call last): >> > >   File "<stdin>", line 1, in <module> >> > > ValueError: null byte in argument for long() >> > > >>> long('123\0', 10) >> > > 123L >> > > >>>

But there is a workaround. You put the base, 10 , as the second argument in the call to long().  

What do you think... give it a try with the base in there?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110503/dcce4382/attachment-0001.html>

More information about the OfflineIMAP-project mailing list