Package: release.debian.org
Severity: normal
Tags: stretch
User: release.debian....@packages.debian.org
Usertags: pu

Dear release team,

The Python 3 version of imaplib2 (python3-imaplib2 package) is currently
unusable in stretch, as it is affected by #902755 and #899102.


#902755: Python 3 version broken, throws exception immediately after connecting

Upstream ships two different versions of imaplib2, one for Python 2 and
one for Python 3. The problem is that the python3-imaplib2 package ships
the Python 2 version. This has been fixed by having debian/rules install
the correct Python module.


#899102: python3-imaplib2: connection to IMAP-SSL host fails on armhf

The Python 3 version of imaplib2 fails on 32-bit architectures, because
the TIMEOUT_MAX value used in Condition.wait() overflows, causing the
above function to return immediately. This has been reported upstream as
  https://github.com/imaplib2/imaplib2/issues/2
  https://github.com/imaplib2/imaplib2/issues/3
and fixed by removing the timeout and having Condition.wait() block
indefinitely (patch submitted at https://github.com/imaplib2/imaplib2/pull/4).


Both of these bugs have been fixed in unstable/testing. I would like to
update python-imaplib2 in stretch to fix the above bugs. Attached is the
proposed diff.

Thanks,

-- 
Ilias
diff -Nru python-imaplib2-2.55/debian/changelog 
python-imaplib2-2.55/debian/changelog
--- python-imaplib2-2.55/debian/changelog       2017-07-12 11:37:15.000000000 
+0300
+++ python-imaplib2-2.55/debian/changelog       2018-09-03 11:44:48.000000000 
+0300
@@ -1,3 +1,15 @@
+python-imaplib2 (2.55-1+deb9u2) stretch; urgency=medium
+
+  * 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)
+  * Apply patch to remove TIMEOUT_MAX variable.
+    On some architectures, using threading.TIMEOUT_MAX for the timeout
+    parameter can overflow causing Condition.wait() to return immediately.
+    Thanks to Maximilian Stein for reporting this (Closes: #899102)
+
+ -- Ilias Tsitsimpis <ilias...@debian.org>  Mon, 03 Sep 2018 11:44:48 +0300
+
 python-imaplib2 (2.55-1+deb9u1) stretch; urgency=medium
 
   * Fix typo that resulted in missing dependencies for python3-imaplib2.
diff -Nru python-imaplib2-2.55/debian/patches/Do-not-use-TIMEOUT_MAX.patch 
python-imaplib2-2.55/debian/patches/Do-not-use-TIMEOUT_MAX.patch
--- python-imaplib2-2.55/debian/patches/Do-not-use-TIMEOUT_MAX.patch    
1970-01-01 02:00:00.000000000 +0200
+++ python-imaplib2-2.55/debian/patches/Do-not-use-TIMEOUT_MAX.patch    
2018-09-02 18:08:03.000000000 +0300
@@ -0,0 +1,68 @@
+From: Ilias Tsitsimpis <ilias...@debian.org>
+Date: Sat, 25 Aug 2018 09:43:41 +0300
+Subject: Do not use TIMEOUT_MAX
+
+On some architectures, using threading.TIMEOUT_MAX for the timeout
+parameter can overflow causing Condition.wait() to return immediately.
+Instead of relying on TIMEOUT_MAX, remove it and wait forever.
+
+Bug-Debian: https://bugs.debian.org/899102
+Bug: https://github.com/imaplib2/imaplib2/issues/3
+Forwarded: https://github.com/imaplib2/imaplib2/pull/4
+---
+ imaplib2.py  | 5 ++---
+ imaplib2.py3 | 4 ++--
+ 2 files changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/imaplib2.py b/imaplib2.py
+index 1fd47d2..3a8b6c0 100755
+--- a/imaplib2.py
++++ b/imaplib2.py
+@@ -67,7 +67,6 @@ if bytes != str:
+ else:
+     import Queue as queue
+     string_types = basestring
+-    threading.TIMEOUT_MAX = 9223372036854.0
+ 
+ select_module = select
+ 
+@@ -192,7 +191,7 @@ class Request(object):
+     def get_response(self, exc_fmt=None):
+         self.callback = None
+         if __debug__: self.parent._log(3, '%s:%s.ready.wait' % (self.name, 
self.tag))
+-        self.ready.wait(threading.TIMEOUT_MAX)
++        self.ready.wait()
+ 
+         if self.aborted is not None:
+             typ, val = self.aborted
+@@ -1391,7 +1390,7 @@ class IMAP4(object):
+             self.commands_lock.release()
+             if need_event:
+                 if __debug__: self._log(3, 'sync command %s waiting for empty 
commands Q' % name)
+-                self.state_change_free.wait(threading.TIMEOUT_MAX)
++                self.state_change_free.wait()
+                 if __debug__: self._log(3, 'sync command %s proceeding' % 
name)
+ 
+         if self.state not in Commands[name][CMD_VAL_STATES]:
+diff --git a/imaplib2.py3 b/imaplib2.py3
+index 0aeff4d..e02f094 100755
+--- a/imaplib2.py3
++++ b/imaplib2.py3
+@@ -182,7 +182,7 @@ class Request(object):
+     def get_response(self, exc_fmt=None):
+         self.callback = None
+         if __debug__: self.parent._log(3, '%s:%s.ready.wait' % (self.name, 
self.tag))
+-        self.ready.wait(threading.TIMEOUT_MAX)
++        self.ready.wait()
+ 
+         if self.aborted is not None:
+             typ, val = self.aborted
+@@ -1316,7 +1316,7 @@ class IMAP4(object):
+             self.commands_lock.release()
+             if need_event:
+                 if __debug__: self._log(3, 'sync command %s waiting for empty 
commands Q' % name)
+-                self.state_change_free.wait(threading.TIMEOUT_MAX)
++                self.state_change_free.wait()
+                 if __debug__: self._log(3, 'sync command %s proceeding' % 
name)
+ 
+         if self.state not in Commands[name][CMD_VAL_STATES]:
diff -Nru python-imaplib2-2.55/debian/patches/series 
python-imaplib2-2.55/debian/patches/series
--- python-imaplib2-2.55/debian/patches/series  1970-01-01 02:00:00.000000000 
+0200
+++ python-imaplib2-2.55/debian/patches/series  2018-09-02 18:08:03.000000000 
+0300
@@ -0,0 +1 @@
+Do-not-use-TIMEOUT_MAX.patch
diff -Nru python-imaplib2-2.55/debian/rules python-imaplib2-2.55/debian/rules
--- python-imaplib2-2.55/debian/rules   2017-07-12 11:30:10.000000000 +0300
+++ python-imaplib2-2.55/debian/rules   2018-07-31 17:44:09.000000000 +0300
@@ -3,8 +3,29 @@
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
-export PYBUILD_NAME = imaplib2
+export PYBUILD_NAME=imaplib2
 export PYBUILD_DISABLE=test
 
+# Upstream ships two different versions of imaplib2, one for Python 2 and one
+# for Python 3. In order to have python3-imaplib2 install the Python 3 version,
+# create a temporary directory where we rename imaplib2.py3 to imaplib2.py
+# and set this as the source files directory for Python 3.
+export PYBUILD_DIR_python3=py3_src_dir
+
+
 %:
-               dh $@ --with python2,python3 --buildsystem=pybuild
+       dh $@ --with python2,python3 --buildsystem=pybuild
+
+py3_src_dir:
+       mkdir -p py3_src_dir
+       cp -a imaplib2.py3 py3_src_dir/imaplib2.py
+       cp -a setup.py py3_src_dir/setup.py
+
+.PHONY: override_dh_auto_configure
+override_dh_auto_configure: py3_src_dir
+       dh_auto_configure
+
+.PHONY: override_dh_auto_clean
+override_dh_auto_clean: py3_src_dir
+       dh_auto_clean
+       rm -rf py3_src_dir

Reply via email to