Comment 3 for bug 1014540

Revision history for this message
Paul Jackson (pj-usa) wrote :

The above patch 'patch offlineimap Maildir savemessageflags rename' is wrong I believe.

I have a new, improved explanation for this problem (but I could still easily be very wrong.)

With the above patch, I started getting crashes when savemessageflags() was called from a different stack:

===============
Copy message 14678 from INBOX.folder:
 WARNING: ERROR attempting to copy message 14678 for account aaaaaa:Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/offlineimap/folder/Base.py", line 255, in copymessageto
    newuid = dstfolder.savemessage(uid, message, flags, rtime)
  File "/usr/lib/pymodules/python2.7/offlineimap/folder/Maildir.py", line 267, in savemessage
    self.savemessageflags(uid, flags)
  File "/usr/lib/pymodules/python2.7/offlineimap/folder/Maildir.py", line 297, in savemessageflags
    os.rename(oldfilename, newfilename)
OSError: [Errno 2] No such file or directory
===============

The problem, in my new improved view, is that the code is not consistent in what is stored in the 'filename' field of messagelist.

Most of the code, including the code in savemessageflags() that I attempted to patch above, is expecting the filename field to have exactly the last two directory components, that being the 'cur' or 'new' prefix, and the messagename.

The root cause of my above reported bug was that one routine had a different view of this. The 'scanfolder()' routine was storing the full pathname, including the value of getfullname(), in the messagelist 'filename' field ... oops.

Please ignore the above patch!

Consider instead, if you would, the following attached patch to scanfolder().

Thanks :).