public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-cheroot] epel9: Rework openssl3 test patch to accept either SSL error string
@ 2026-10-26 14:12 Dan Radez
  0 siblings, 0 replies; only message in thread
From: Dan Radez @ 2026-10-26 14:12 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-cheroot
            Branch : epel9
            Commit : 6e46cdb4aa5002389ed5a9f592b611f1bf9a8030
            Author : Dan Radez <dan@radez.net>
            Date   : 2026-10-26T10:12:31-04:00
            Stats  : +30/-55 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-cheroot/c/6e46cdb4aa5002389ed5a9f592b611f1bf9a8030?branch=epel9

            Log:
            Rework openssl3 test patch to accept either SSL error string

EL9 rebased to OpenSSL 3.5, which made the patched
test_https_over_http_error expect 'record layer failure' while Python
still reports 'wrong version number', causing an FTBFS. Accept either
string instead of guessing from the OpenSSL version (cheroot#645).

---
diff --git a/0001-handle-openssl3-error-in-ssl-tests.patch b/0001-handle-openssl3-error-in-ssl-tests.patch
index 8a26666..5adcef7 100644
--- a/0001-handle-openssl3-error-in-ssl-tests.patch
+++ b/0001-handle-openssl3-error-in-ssl-tests.patch
@@ -1,75 +1,46 @@
-From 6d0a7403a6cdf4041d1a3f388dc60b2b95e5e857 Mon Sep 17 00:00:00 2001
+From d3dc1c940fa2118e6e943a2414d81ed8538fd60c Mon Sep 17 00:00:00 2001
 From: Dan Radez <dradez@redhat.com>
-Date: Tue, 2 Apr 2024 10:33:42 -0400
+Date: Mon, 26 Oct 2026 08:50:57 -0400
 Subject: [PATCH] handle openssl3 error in ssl tests
 
-Using OpenSSL 3, the expected error string caught in ssl tests has changed.
+With OpenSSL 3.2+ the error raised when speaking HTTPS to a plain HTTP
+port may be reported as 'record layer failure' instead of 'wrong version
+number', depending on the OpenSSL and Python versions in use:
+
 E       AssertionError: assert 'wrong version number' in
                                  '[SSL] record layer failure (_ssl.c:1000)'
 
-This is already handled for OpenSSL pre-1.1 and gte-1.1, adding handling
-for OpenSSL 3+
+Accept either string rather than guessing from the OpenSSL version.
 
 Fixes: #645
 ---
- cheroot/_compat.py       | 2 ++
- cheroot/_compat.pyi      | 1 +
- cheroot/test/test_ssl.py | 7 ++++---
- 3 files changed, 7 insertions(+), 3 deletions(-)
+ cheroot/test/test_ssl.py | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
 
-diff --git a/cheroot/_compat.py b/cheroot/_compat.py
-index dbe5c6d2..edbfe28d 100644
---- a/cheroot/_compat.py
-+++ b/cheroot/_compat.py
-@@ -8,9 +8,11 @@ import platform
- try:
-     import ssl
-     IS_ABOVE_OPENSSL10 = ssl.OPENSSL_VERSION_INFO >= (1, 1)
-+    IS_ABOVE_OPENSSL31 = ssl.OPENSSL_VERSION_INFO >= (3, 2)
-     del ssl
- except ImportError:
-     IS_ABOVE_OPENSSL10 = None
-+    IS_ABOVE_OPENSSL31 = None
- 
- 
- IS_CI = bool(os.getenv('CI'))
-diff --git a/cheroot/_compat.pyi b/cheroot/_compat.pyi
-index 67d93cf6..785259d2 100644
---- a/cheroot/_compat.pyi
-+++ b/cheroot/_compat.pyi
-@@ -3,6 +3,7 @@ from typing import Any, ContextManager, Optional, Type, Union
- def suppress(*exceptions: Type[BaseException]) -> ContextManager[None]: ...
- 
- IS_ABOVE_OPENSSL10: Optional[bool]
-+IS_ABOVE_OPENSSL31: Optional[bool]
- IS_CI: bool
- IS_GITHUB_ACTIONS_WORKFLOW: bool
- IS_PYPY: bool
 diff --git a/cheroot/test/test_ssl.py b/cheroot/test/test_ssl.py
-index 1900e20d..a084f4d4 100644
+index 1900e20..935333b 100644
 --- a/cheroot/test/test_ssl.py
 +++ b/cheroot/test/test_ssl.py
-@@ -17,7 +17,7 @@ import requests
- import trustme
- 
- from .._compat import bton, ntob, ntou
--from .._compat import IS_ABOVE_OPENSSL10, IS_CI, IS_PYPY
-+from .._compat import IS_ABOVE_OPENSSL10, IS_ABOVE_OPENSSL31, IS_CI, IS_PYPY
- from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS
- from ..server import HTTPServer, get_ssl_adapter_class
- from ..testing import (
-@@ -597,8 +597,9 @@ def test_https_over_http_error(http_server, ip_addr):
+@@ -596,11 +596,15 @@ def test_https_over_http_error(http_server, ip_addr):
+                 port=port,
              ),
          ).request('GET', '/')
-     expected_substring = (
+-    expected_substring = (
 -        'wrong version number' if IS_ABOVE_OPENSSL10
 -        else 'unknown protocol'
-+      'record layer failure' if IS_ABOVE_OPENSSL31
-+      else 'wrong version number' if IS_ABOVE_OPENSSL10
-+      else 'unknown protocol'
++    # The reported string depends on both the OpenSSL and Python versions:
++    # 'wrong version number' or 'record layer failure' (OpenSSL 3.2+)
++    expected_substrings = (
++        ('wrong version number', 'record layer failure')
++        if IS_ABOVE_OPENSSL10
++        else ('unknown protocol',)
      )
-     assert expected_substring in ssl_err.value.args[-1]
+-    assert expected_substring in ssl_err.value.args[-1]
++    err_msg = ssl_err.value.args[-1]
++    assert any(s in err_msg for s in expected_substrings), err_msg
+ 
  
+ @pytest.mark.parametrize(
 -- 
-2.44.0
+2.56.0
 

diff --git a/python-cheroot.spec b/python-cheroot.spec
index 5dd0c0e..9555574 100644
--- a/python-cheroot.spec
+++ b/python-cheroot.spec
@@ -5,7 +5,7 @@
 
 Name:           python-%{pypi_name}
 Version:        10.0.1
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Highly-optimized, pure-python HTTP server
 
 # Automatically converted from old format: BSD - review is highly recommended.
@@ -128,6 +128,10 @@ timeout --kill-after=10 300 \
 %endif
 
 %changelog
+* Mon Oct 26 2026 Dan Radez <dradez@redhat.com> - 10.0.1-6
+- Rework openssl3 test patch to accept either SSL error string, fixes FTBFS
+  with EL9's OpenSSL 3.5 (cheroot#645)
+
 * Thu Mar 20 2025 Dan Radez <dradez@redhat.com> - 10.0.1-5
 - Deselect tests incompatible with EPEL 9 libraries
 - Add timeout wrapper for hung cheroot server threads

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-26 14:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 14:12 [rpms/python-cheroot] epel9: Rework openssl3 test patch to accept either SSL error string Dan Radez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox