Your message dated Tue, 31 Jul 2018 10:04:55 +0000
with message-id <[email protected]>
and subject line Bug#902755: fixed in python-imaplib2 2.57-3
has caused the Debian Bug report #902755,
regarding Python 3 version broken, throws exception immediately after connecting
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
902755: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=902755
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python3-imaplib2
Version: 2.57-2
Severity: grave

Hi,

Using this test program and Gmail as the IMAP server:
    M = imaplib2.IMAP4_SSL(host=IMAP_SERVER, debug=IMAP_DEBUG)
    M.login(IMAP_USERNAME, IMAP_PASSWORD)
    if (compress):
        M.enable_compression()

    M.SELECT(mailbox=IMAP_MAILBOX, readonly=True)
    M.FETCH('1:10', '(UID FLAGS)')
    M.LOGOUT()

...the Python3 version of this package immediately throws an exception
after connecting and thus seems entirely broken:
  imaplib2.error: IMAP4 protocol error: program error: <class 'TypeError'> - 
cannot use a bytes pattern on a string-like object

Even after fixing this, there is an additional issue that shows up only
when enabling compression:
  imaplib2.abort: command: EXAMINE => socket error: <class 'TypeError'> - a 
bytes-like object is required, not 'str'

Note that even stretch's 2.55 presents the latter issue, but not the
former.

The attached patch fixes both of those issues and makes the above simple
test case work, although I haven't tried this any more complicated cases or
with different IMAP servers.

I went to upstream's GitHub in order to see if anyone else had reported
this or to submit a PR, but to my surprise, it seems like upstream's
repository has two different versions of imaplib2, one of them
designated as "py3" and reporting itself as v3.05. That version does not
exhibit any of these two issues above.

Regards,
Faidon
--- x/usr/lib/python3/dist-packages/imaplib2.py	2017-03-05 03:23:58.000000000 +0200
+++ /usr/lib/python3/dist-packages/imaplib2.py	2018-06-30 15:36:18.645224464 +0300
@@ -302,8 +302,8 @@
 
 
     # These must be encoded according to utf8 setting in _mode_xxx():
-    _literal = br'.*{(?P<size>\d+)}$'
-    _untagged_status = br'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?'
+    _literal = r'.*{(?P<size>\d+)}$'
+    _untagged_status = r'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?'
 
     continuation_cre = re.compile(r'\+( (?P<data>.*))?')
     mapCRLF_cre = re.compile(r'\r\n|\r|\n')
@@ -2215,13 +2215,13 @@
         """send(data)
         Send 'data' to remote."""
 
+        if bytes != str:
+            data = bytes(data, 'utf8')
+
         if self.compressor is not None:
             data = self.compressor.compress(data)
             data += self.compressor.flush(zlib.Z_SYNC_FLUSH)
 
-        if bytes != str:
-            data = bytes(data, 'utf8')
-
         if hasattr(self.sock, "sendall"):
             self.sock.sendall(data)
         else:

--- End Message ---
--- Begin Message ---
Source: python-imaplib2
Source-Version: 2.57-3

We believe that the bug you reported is fixed in the latest version of
python-imaplib2, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Ilias Tsitsimpis <[email protected]> (supplier of updated python-imaplib2 
package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 31 Jul 2018 12:14:47 +0300
Source: python-imaplib2
Binary: python-imaplib2 python3-imaplib2
Architecture: source
Version: 2.57-3
Distribution: unstable
Urgency: low
Maintainer: Ulises Vitulli <[email protected]>
Changed-By: Ilias Tsitsimpis <[email protected]>
Description:
 python-imaplib2 - Threaded Python IMAP4 client
 python3-imaplib2 - Threaded Python IMAP4 client (Python 3)
Closes: 902755
Changes:
 python-imaplib2 (2.57-3) unstable; urgency=low
 .
   * Install the correct module for Python 3.
     Until now, python3-imaplib2 installed the Python 2 version of this module.
     Thanks to Faidon Liambotis for reporting this (Closes: 902755)
   * Set Rules-Requires-Root to no.
     Declares that neither root nor fakeroot is required.
   * Bump Standards-Version to 4.1.5, no changes needed
Checksums-Sha1:
 4048577785e3868439cd601c937296d9fbbbfc74 2106 python-imaplib2_2.57-3.dsc
 b14ed0159633f7d4b4a2be1a3866c8ffcb261f4e 5424 
python-imaplib2_2.57-3.debian.tar.xz
 9442088e39f9126e4d277a7ed6e01e4d09b37a56 7071 
python-imaplib2_2.57-3_amd64.buildinfo
Checksums-Sha256:
 b4e323b90b0c45c5c2de28c4705f9daf20a4eebd7aeb60e77e5a24571b1b2195 2106 
python-imaplib2_2.57-3.dsc
 665b0d468bdd015a7c24d13258fbe31bf6633119e3bd04ae85d6bc9e5461935e 5424 
python-imaplib2_2.57-3.debian.tar.xz
 43574a45bc07f12ad2784f6d4d9de376dbe85554e6dae2e3545f2a9265c2ddfa 7071 
python-imaplib2_2.57-3_amd64.buildinfo
Files:
 2e3ef769fd986e85accc24c88928d53e 2106 python optional 
python-imaplib2_2.57-3.dsc
 e6d2d95800fceb6e36f0991b0c628e92 5424 python optional 
python-imaplib2_2.57-3.debian.tar.xz
 8882031420ca316b3778067c6a1eb32e 7071 python optional 
python-imaplib2_2.57-3_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEJ9c8pfW11+AaUTb116hngMxkQDwFAltgMp8UHGlsaWFzdHNp
QGRlYmlhbi5vcmcACgkQ16hngMxkQDwZ0RAAinKJeZEfvVHhgLuE5WRExGRPw8/v
8+z1GAhcPYVEIsmMdGrXVWp2taCEyxisbfRSDpXYuVwqywbc8iHfF9nqgOGQugP5
35OYH1meU2A/y7AvHmcTFKdbVSM3aRcYtblLXhs8J6+afOGhvDFas6AXCsdKVNQX
SWZPBO+77cFbqYbxVvhEkLH3eSFTqVXd50vkC0J66tvHcN31X2jkAqYAosEV/AQP
vzKj6PCL+2U02vN16tq+Rsw6q22EJ8jIFtWakNd8Tm5wE7JCK85c25Nc5Xf4e6fi
m2CtFyJ76oL+Il1egzH8eqWK7Md7UcTHYwMz80w5S5p9P+1BGWVssJXYHNCQU7uf
5S7K804kD2LT4a93oayKMKz8L3X6wDMNueGluGsmBAZkGMPdTdW3jOrvcve0G45e
nZDFZKLtNIlNhT3+5NQDys0XuX45qVZ/fZe84bM/wXV5AtuAZjYliCsaEKozBwCh
EfCVHJqUmKgLqfHt59qb7Crys0PIm8RQBPaAzV75UEs0n+elpSKOiCVcX/9Xn1x+
YZPSzLzJQKEXb5k7JZmhzLPhSRMiWr5bkCbLt9KOLvgUJygGFiobnynSvfhNpIDx
9obI+uazfe9eaqRissSmr5YTEO4cVgO/nOKqfxeRIW23ex0ba+aBOXTWH/YPMvch
fVv3ua9XRXvWnbg=
=TslW
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to