Hi,

http://bugs.debian.org/596291 links to the correct commit for a fix, although it is nothing to do with threading; the bug is that a read() on a FD comes back with zero bytes (its an EOF).

The following fixes the bug:

https://github.com/OfflineIMAP/offlineimap/commit/b94bf792585a9297851bdb965c4bbd6bdadeeb42

It does not apply cleanly to the Debian squeeze version, but I have been running for some time the attached patch based on it.

Cheers

--
Alexander Clouter
.sigmonster says: BOFH excuse #166:
                  /pub/lunch
diff -u -r offlineimap-6.2.0.2/offlineimap/imaplibutil.py offlineimap-6.2.0.2.orig/offlineimap/imaplibutil.py
--- offlineimap-6.2.0.2/offlineimap/imaplibutil.py	2012-12-01 14:22:41.932000001 +0000
+++ offlineimap-6.2.0.2.orig/offlineimap/imaplibutil.py	2010-06-29 22:49:59.000000000 +0100
@@ -49,10 +49,7 @@
     def read(self, size):
         retval = ''
         while len(retval) < size:
-            buf = self.infd.read(size - len(retval))
-            if not buf:
-                break
-            retval += buf
+            retval += self.infd.read(size - len(retval))
         return retval
 
     def readline(self):
@@ -97,8 +94,6 @@
         retval = ''
         while 1:
             linebuf = self.read(1024)
-            if not linebuf:
-                return retval
             nlindex = linebuf.find("\n")
             if nlindex != -1:
                 retval += linebuf[:nlindex + 1]
diff -u -r offlineimap-6.2.0.2/offlineimap/imapserver.py offlineimap-6.2.0.2.orig/offlineimap/imapserver.py
--- offlineimap-6.2.0.2/offlineimap/imapserver.py	2012-12-01 14:18:58.056000001 +0000
+++ offlineimap-6.2.0.2.orig/offlineimap/imapserver.py	2010-06-29 22:49:59.000000000 +0100
@@ -74,8 +74,6 @@
             io = StringIO()
             while read < size:
                 data = imaplib.IMAP4.read (self, min(size-read,8192))
-                if not data:
-                    break
                 read += len(data)
                 io.write(data)
             return io.getvalue()
@@ -95,8 +93,6 @@
             io = StringIO()
             while read < size:
                 data = imaplibutil.WrappedIMAP4_SSL.read (self, min(size-read,8192))
-                if not data:
-                    break
                 read += len(data)
                 io.write(data)
             return io.getvalue()

Reply via email to