Assertion failures

Nicolas Sebrecht nicolas.s-dev at laposte.net
Fri Mar 7 22:40:33 GMT 2014


On Wed, Mar 05, 2014 at 02:33:25PM +0000, ael wrote:
> In the last few days, I have seen offlineimap failing in odd ways.
> 
> I am running  version 6.5.5 under debian testing.
> 
> One Assertion which sometimes  fails is in
> /usr/local/lib/python2.7/dist-packages/offlineimap/folder/LocalStatus.py
> 
> In the  cachemessagelist method we have
> 
> file = open(self.filename, "rt")
>         self.messagelist = {}
>         line = file.readline().strip()
>         if not line:
>             # The status file is empty - should not have happened,
>             # but somehow did.
>             errstr = "Cache file '%s' is empty. Closing..." % self.filename
>             self.ui.warn(errstr)
>             file.close()
>             return
>         print("line =", line, "magic=", magicline)   <== debug print
>         assert(line == magicline)              <=======
>         for line in file.xreadlines():
> 
> Running with that extra print statement shows that most of the time
> it is ok, but then it fails with what looks like a hex formatted string.
> For example:
> 
>  Syncing [Gmail]/Spam: Gmail -> Maildir
> ('line =', 'OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1', 'magic=', 'OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1')
> Folder INBOX [acc: ntlspam]:
>  Syncing INBOX: Gmail -> Maildir
> ('line =', 'OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1', 'magic=', 'OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1')
> Folder SentMail [acc: ntlspam]:
>  Syncing SentMail: Gmail -> Maildir
> ('line =', 'OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1', 'magic=', 'OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1')
> Folder Spam [acc: ntlspam]:
>  Syncing Spam: Gmail -> Maildir
> ('line =', '\xd9\x80\x9e\x9c<%\x86=Q\xbf\xa2"\xe0\xd9y\xe55\xce\x9b\xd4>\x15I\xa4Sw}iu.\xec\xff\x15|\xac\\\x851\xcc$\x8fg\\bc\xe4A\xf7\x04\xa7an\x12\xa1\xbf\xc0\x03\x88\x85\xa0qeSBuf\x87bI\xae\xb4\xf7\x0f+\x9ay\xd1V\xba\x0c\x19\x83\x16\x19\x9cT\xe3n\x13\xca\xc4\xa5\x82\x90\xd7Q\xc2\xc1', 'magic=', 'OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1')
> 
> --------------------------------------------------------------------
> 
> I have noticed other similar errors. 

This is python unicode strings. It looks like the string is read in
unicode sometime. I would not be surprised that the file has unicode
characters.

BTW, I hate the "magic" python has to handle unicode. It stabs in the
back.

-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list