Skip to contentSkip to conversation

python: fix failing ssl tests

PATCH In review Anuj Mittal 3 participants 6 messages Oct 4, 2018 – Oct 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 python: fix failing ssl tests

Backport two and pick some other in-review patches from Ubuntu to fix ssl test failures because of OpenSSL 1.1.x changes.

Fixes [YOCTO #12788]

---
 meta/recipes-devtools/python/python.inc       |   8 +-
 ...st_ssl-when-a-filename-cannot-be-enc.patch |  57 +++++++++
 ...3-ciphers-for-OpenSSL-1.1.1-GH-6976-.patch | 120 ++++++++++++++++++
 ...ssing-closing-wrapper-in-test_tls1_3.patch |  37 ++++++
 ...st_ssl.test_options-to-account-for-O.patch |  37 ++++++
 ...st_default_ecdh_curve-needs-no-tlsv1.patch |  34 +++++
 6 files changed, 292 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/python/python/0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch
 create mode 100644 meta/recipes-devtools/python/python/0001-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976-.patch
 create mode 100644 meta/recipes-devtools/python/python/0002-bpo-34818-Add-missing-closing-wrapper-in-test_tls1_3.patch
 create mode 100644 meta/recipes-devtools/python/python/0003-bpo-34834-Fix-test_ssl.test_options-to-account-for-O.patch
 create mode 100644 meta/recipes-devtools/python/python/0004-bpo-34836-fix-test_default_ecdh_curve-needs-no-tlsv1.patch
meta/recipes-devtools/python/python.inc +7 -1
index 901acd0219..66923678b1 100644
@@ -7,7 +7,13 @@ INC_PR = "r1"
 
 LIC_FILES_CHKSUM = "file://LICENSE;md5=f257cc14f81685691652a3d3e1b5d754"
 
-SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz"
+SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
+           file://0001-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976-.patch \
+           file://0002-bpo-34818-Add-missing-closing-wrapper-in-test_tls1_3.patch \
+           file://0003-bpo-34834-Fix-test_ssl.test_options-to-account-for-O.patch \
+           file://0004-bpo-34836-fix-test_default_ecdh_curve-needs-no-tlsv1.patch \
+           file://0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch \
+           "
 
 SRC_URI[md5sum] = "a80ae3cc478460b922242f43a1b4094d"
 SRC_URI[sha256sum] = "22d9b1ac5b26135ad2b8c2901a9413537e08749a753356ee913c84dbd2df5574"
meta/recipes-devtools/python/python/0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch new file +57 -0

57 lines not on this page · raw message

meta/recipes-devtools/python/python/0001-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976-.patch new file +120 -0

120 lines not on this page · raw message

meta/recipes-devtools/python/python/0002-bpo-34818-Add-missing-closing-wrapper-in-test_tls1_3.patch new file +37 -0
new file mode 100644
index 0000000000..96882712e9
@@ -0,0 +1,37 @@
+From 0e1f3856a7e1511fb64d99646c54ddf3897cd444 Mon Sep 17 00:00:00 2001
+From: Dimitri John Ledkov <[email protected]>
+Date: Fri, 28 Sep 2018 14:15:52 +0100
+Subject: [PATCH 2/4] bpo-34818: Add missing closing() wrapper in test_tls1_3.
+
+Python 2.7 socket classes do not implement context manager protocol,
+hence closing() is required around it. Resolves testcase error
+traceback.
+
+Signed-off-by: Dimitri John Ledkov <[email protected]>
+
+https://bugs.python.org/issue34818
+
+Patch taken from Ubuntu.
+
+Upstream-Status: Submitted [https://github.com/python/cpython/pull/9622]
+Signed-off-by: Anuj Mittal <[email protected]>
+---
+ Lib/test/test_ssl.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
+index f51572e319..7a14053cee 100644
+--- a/Lib/test/test_ssl.py
++++ b/Lib/test/test_ssl.py
+@@ -2817,7 +2817,7 @@ else:
+                 ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1_2
+             )
+             with ThreadedEchoServer(context=context) as server:
+-                with context.wrap_socket(socket.socket()) as s:
++                with closing(context.wrap_socket(socket.socket())) as s:
+                     s.connect((HOST, server.port))
+                     self.assertIn(s.cipher()[0], [
+                         'TLS_AES_256_GCM_SHA384',
+-- 
+2.17.1
+
meta/recipes-devtools/python/python/0003-bpo-34834-Fix-test_ssl.test_options-to-account-for-O.patch new file +37 -0
new file mode 100644
index 0000000000..77016cb430
@@ -0,0 +1,37 @@
+From 8b06d56d26eee289fec22b9b72ab4c7cc3d6c482 Mon Sep 17 00:00:00 2001
+From: Dimitri John Ledkov <[email protected]>
+Date: Fri, 28 Sep 2018 16:34:16 +0100
+Subject: [PATCH 3/4] bpo-34834: Fix test_ssl.test_options to account for
+ OP_ENABLE_MIDDLEBOX_COMPAT.
+
+Signed-off-by: Dimitri John Ledkov <[email protected]>
+
+https://bugs.python.org/issue34834
+
+Patch taken from Ubuntu.
+Upstream-Status: Submitted [https://github.com/python/cpython/pull/9624]
+
+Signed-off-by: Anuj Mittal <[email protected]>
+---
+ Lib/test/test_ssl.py | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
+index 7a14053cee..efc906a5ba 100644
+--- a/Lib/test/test_ssl.py
++++ b/Lib/test/test_ssl.py
+@@ -777,6 +777,11 @@ class ContextTests(unittest.TestCase):
+         default = (ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3)
+         if not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0):
+             default |= ssl.OP_NO_COMPRESSION
++        if not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 1):
++            # define MIDDLEBOX constant, as python2.7 does not know about it
++            # but it is used by default.
++            OP_ENABLE_MIDDLEBOX_COMPAT = 1048576L
++            default |= OP_ENABLE_MIDDLEBOX_COMPAT
+         self.assertEqual(default, ctx.options)
+         ctx.options |= ssl.OP_NO_TLSv1
+         self.assertEqual(default | ssl.OP_NO_TLSv1, ctx.options)
+-- 
+2.17.1
+
meta/recipes-devtools/python/python/0004-bpo-34836-fix-test_default_ecdh_curve-needs-no-tlsv1.patch new file +34 -0
new file mode 100644
index 0000000000..39e1bcfc86
@@ -0,0 +1,34 @@
+From 946a7969345c6697697effd226ec396d3fea05b7 Mon Sep 17 00:00:00 2001
+From: Dimitri John Ledkov <[email protected]>
+Date: Fri, 28 Sep 2018 17:30:19 +0100
+Subject: [PATCH 4/4] bpo-34836: fix test_default_ecdh_curve, needs no tlsv1.3.
+
+Signed-off-by: Dimitri John Ledkov <[email protected]>
+
+https://bugs.python.org/issue34836
+
+Patch taken from Ubuntu.
+Upstream-Status: Submitted [https://github.com/python/cpython/pull/9626]
+
+Signed-off-by: Anuj Mittal <[email protected]>
+---
+ Lib/test/test_ssl.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
+index efc906a5ba..4a3286cd5f 100644
+--- a/Lib/test/test_ssl.py
++++ b/Lib/test/test_ssl.py
+@@ -2836,6 +2836,9 @@ else:
+             # should be enabled by default on SSL contexts.
+             context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+             context.load_cert_chain(CERTFILE)
++            # TLSv1.3 defaults to PFS key agreement and no longer has KEA in
++            # cipher name.
++            context.options |= ssl.OP_NO_TLSv1_3
+             # Prior to OpenSSL 1.0.0, ECDH ciphers have to be enabled
+             # explicitly using the 'ECCdraft' cipher alias.  Otherwise,
+             # our default cipher list should prefer ECDH-based ciphers
+-- 
+2.17.1
+
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 python: consolidate common patches

Move inclusion of common patches to .inc to simplify things a bit.

---
 meta/recipes-devtools/python/python-native_2.7.15.bb | 3 ---
 meta/recipes-devtools/python/python.inc              | 3 +++
 meta/recipes-devtools/python/python_2.7.15.bb        | 3 ---
 3 files changed, 3 insertions(+), 6 deletions(-)
meta/recipes-devtools/python/python-native_2.7.15.bb +0 -3
index 7c491fa3e0..ee2ec1082a 100644
@@ -11,10 +11,7 @@ SRC_URI += "\
             file://debug.patch \
             file://unixccompiler.patch \
             file://nohostlibs.patch \
-            file://multilib.patch \
-            file://add-md5module-support.patch \
             file://builddir.patch \
-            file://parallel-makeinst-create-bindir.patch \
             file://revert_use_of_sysconfigdata.patch \
            "
 
meta/recipes-devtools/python/python.inc +3 -0
index 66923678b1..38cc79cb41 100644
@@ -13,6 +13,9 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
            file://0003-bpo-34834-Fix-test_ssl.test_options-to-account-for-O.patch \
            file://0004-bpo-34836-fix-test_default_ecdh_curve-needs-no-tlsv1.patch \
            file://0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch \
+           file://multilib.patch \
+           file://add-md5module-support.patch \
+           file://parallel-makeinst-create-bindir.patch \
            "
 
 SRC_URI[md5sum] = "a80ae3cc478460b922242f43a1b4094d"
meta/recipes-devtools/python/python_2.7.15.bb +0 -3
index 472c1da4bf..8bc0f273ec 100644
@@ -12,10 +12,8 @@ SRC_URI += "\
   file://03-fix-tkinter-detection.patch \
   file://06-avoid_usr_lib_termcap_path_in_linking.patch \
   ${DISTRO_SRC_URI} \
-  file://multilib.patch \
   file://cgi_py.patch \
   file://setup_py_skip_cross_import_check.patch \
-  file://add-md5module-support.patch \
   file://host_include_contamination.patch \
   file://fix_for_using_different_libdir.patch \
   file://setuptweaks.patch \
@@ -26,7 +24,6 @@ SRC_URI += "\
   file://python-2.7.3-remove-bsdb-rpath.patch \
   file://fix-makefile-for-ptest.patch \
   file://run-ptest \
-  file://parallel-makeinst-create-bindir.patch \
   file://use_sysroot_ncurses_instead_of_host.patch \
   file://add-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \
   file://pass-missing-libraries-to-Extension-for-mul.patch \
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/2] python: consolidate common patches

Hey Anuj,

Quoted 29 lines · Anuj Mittal

Move inclusion of common patches to .inc to simplify things a bit.

---
  meta/recipes-devtools/python/python-native_2.7.15.bb | 3 ---
  meta/recipes-devtools/python/python.inc              | 3 +++
  meta/recipes-devtools/python/python_2.7.15.bb        | 3 ---
  3 files changed, 3 insertions(+), 6 deletions(-)
meta/recipes-devtools/python/python-native_2.7.15.bb +0 -3
index 7c491fa3e0..ee2ec1082a 100644
@@ -11,10 +11,7 @@ SRC_URI += "\
              file://debug.patch \
              file://unixccompiler.patch \
              file://nohostlibs.patch \
-            file://multilib.patch \
-            file://add-md5module-support.patch \
              file://builddir.patch \
-            file://parallel-makeinst-create-bindir.patch \
              file://revert_use_of_sysconfigdata.patch \
             "
 
meta/recipes-devtools/python/python.inc +0 -0
index 66923678b1..38cc79cb41 100644

meta/recipes-devtools/python/python.inc SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ · line 15

Quoted 3 lines
meta/recipes-devtools/python/python.inc +0 -0
@@ -13,6 +13,9 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
             file://0003-bpo-34834-Fix-test_ssl.test_options-to-account-for-O.patch \
             file://0004-bpo-34836-fix-test_default_ecdh_curve-needs-no-tlsv1.patch \
             file://0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch \

The multilib.patch is actually a different file for the native and target packages, I suggest we rename it and keep it on each recipe separately.

Cheers,

Alejandro

Quoted 29 lines
meta/recipes-devtools/python/python.inc +3 -0
+           file://multilib.patch \
+           file://add-md5module-support.patch \
+           file://parallel-makeinst-create-bindir.patch \
             "
 
  SRC_URI[md5sum] = "a80ae3cc478460b922242f43a1b4094d"
meta/recipes-devtools/python/python_2.7.15.bb +0 -3
index 472c1da4bf..8bc0f273ec 100644
@@ -12,10 +12,8 @@ SRC_URI += "\
    file://03-fix-tkinter-detection.patch \
    file://06-avoid_usr_lib_termcap_path_in_linking.patch \
    ${DISTRO_SRC_URI} \
-  file://multilib.patch \
    file://cgi_py.patch \
    file://setup_py_skip_cross_import_check.patch \
-  file://add-md5module-support.patch \
    file://host_include_contamination.patch \
    file://fix_for_using_different_libdir.patch \
    file://setuptweaks.patch \
@@ -26,7 +24,6 @@ SRC_URI += "\
    file://python-2.7.3-remove-bsdb-rpath.patch \
    file://fix-makefile-for-ptest.patch \
    file://run-ptest \
-  file://parallel-makeinst-create-bindir.patch \
    file://use_sysroot_ncurses_instead_of_host.patch \
    file://add-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \
    file://pass-missing-libraries-to-Extension-for-mul.patch \
#3 lore raw

Re: [PATCH 2/2] python: consolidate common patches

Quoted 28 lines · Alejandro Enedino Hernandez Samaniego

Hey Anuj,

Quoted 24 lines · Anuj Mittal

Move inclusion of common patches to .inc to simplify things a bit.

---
  meta/recipes-devtools/python/python-native_2.7.15.bb | 3 ---
  meta/recipes-devtools/python/python.inc              | 3 +++
  meta/recipes-devtools/python/python_2.7.15.bb        | 3 ---
  3 files changed, 3 insertions(+), 6 deletions(-)
meta/recipes-devtools/python/python-native_2.7.15.bb +0 -3
index 7c491fa3e0..ee2ec1082a 100644
@@ -11,10 +11,7 @@ SRC_URI += "\
              file://debug.patch \
              file://unixccompiler.patch \
              file://nohostlibs.patch \
-            file://multilib.patch \
-            file://add-md5module-support.patch \
              file://builddir.patch \
-            file://parallel-makeinst-create-bindir.patch \
              file://revert_use_of_sysconfigdata.patch \
             "
 
Quoted 13 lines

meta/recipes-devtools/python/python.inc SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ · line 15

Quoted 8 lines
meta/recipes-devtools/python/python.inc +0 -0
index 66923678b1..38cc79cb41 100644
@@ -13,6 +13,9 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
             file://0003-bpo-34834-Fix-test_ssl.test_options-to-account-for-O.patch \
             file://0004-bpo-34836-fix-test_default_ecdh_curve-needs-no-tlsv1.patch \
             file://0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch \

The multilib.patch is actually a different file for the native and target packages, I suggest we rename it and keep it on each recipe separately.

Thanks Alejandro for checking. You're right. Both patches look like they are doing the exact same thing though and perhaps one of them should be removed. But, this patch was supposed to be a trivial cleanup.

So, can this (2/2 only) be ignored please? I will take a look at it later after the release.

Thanks,

Anuj

#4 lore raw

Re: [PATCH 2/2] python: consolidate common patches

In reply to Alejandro Enedino Hernandez Samaniego
Quoted 28 lines · Alejandro Enedino Hernandez Samaniego

Hey Anuj,

Quoted 24 lines · Anuj Mittal

Move inclusion of common patches to .inc to simplify things a bit.

---
  meta/recipes-devtools/python/python-native_2.7.15.bb | 3 ---
  meta/recipes-devtools/python/python.inc              | 3 +++
  meta/recipes-devtools/python/python_2.7.15.bb        | 3 ---
  3 files changed, 3 insertions(+), 6 deletions(-)
meta/recipes-devtools/python/python-native_2.7.15.bb +0 -3
index 7c491fa3e0..ee2ec1082a 100644
@@ -11,10 +11,7 @@ SRC_URI += "\
              file://debug.patch \
              file://unixccompiler.patch \
              file://nohostlibs.patch \
-            file://multilib.patch \
-            file://add-md5module-support.patch \
              file://builddir.patch \
-            file://parallel-makeinst-create-bindir.patch \
              file://revert_use_of_sysconfigdata.patch \
             "
 
Quoted 13 lines

meta/recipes-devtools/python/python.inc SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ · line 15

Quoted 8 lines
meta/recipes-devtools/python/python.inc +0 -0
index 66923678b1..38cc79cb41 100644
@@ -13,6 +13,9 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
             file://0003-bpo-34834-Fix-test_ssl.test_options-to-account-for-O.patch \
             file://0004-bpo-34836-fix-test_default_ecdh_curve-needs-no-tlsv1.patch \
             file://0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch \

The multilib.patch is actually a different file for the native and target packages, I suggest we rename it and keep it on each recipe separately.

Thanks Alejandro for checking. You're right. Both patches look like they are doing the exact same thing though and perhaps one of them should be removed. But, this patch was supposed to be a trivial cleanup.

So, can this (2/2 only) be ignored please? I will take a look at it later after the release.

Thanks,

Anuj

#5 lore raw

✗ patchtest: failure for "python: fix failing ssl tests..." and 1 more

In reply to Anuj Mittal

== Series Details ==

Series: "python: fix failing ssl tests..." and 1 more
Revision: 1
URL : https://patchwork.openembedded.org/series/14355/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Upstream-Status is in incorrect format [test_upstream_status_presence_format]

  Suggested fix    Fix Upstream-Status format in 0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch
  Current          Upstream-Status:
  Standard format  Upstream-Status: <Valid status>
  Valid status     Pending, Accepted, Backport, Denied, Inappropriate [reason], Submitted [where]

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe