From e6a7ab919dc4d7b4b1a5ba56f8a049aa9dd4075a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Wed, 10 Apr 2024 11:49:31 +0200 Subject: [PATCH] Update to 3.12.3 Related: RHEL-33690 --- 00251-change-user-install-location.patch | 6 +- ...or-the-main-thread-gh-28549-gh-28589.patch | 8 +- ...-addresses-in-email-parseaddr-111116.patch | 6 +- ...on-t-generate-sbom-in-make-regen-all.patch | 36 -------- ...s-for-xmlpullparser-with-expat-2-6-0.patch | 63 +++++++++++++ ...s-for-xmlpullparser-with-expat-2-6-0.patch | 88 ------------------- ...st-wheeldata-when-it-s-actually-used.patch | 28 ++++++ python3.12.spec | 31 ++++--- sources | 4 +- 9 files changed, 120 insertions(+), 150 deletions(-) delete mode 100644 00418-don-t-generate-sbom-in-make-regen-all.patch create mode 100644 00422-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch delete mode 100644 00422-gh-115133-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch create mode 100644 00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch diff --git a/00251-change-user-install-location.patch b/00251-change-user-install-location.patch index dc29bca..c3938ae 100644 --- a/00251-change-user-install-location.patch +++ b/00251-change-user-install-location.patch @@ -129,7 +129,7 @@ index 122d441bd1..2d354a11da 100644 # On Windows we want to substitute 'lib' for schemes rather # than the native value (without modifying vars, in case it diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py -index b6dbf3d52c..4f06a7673c 100644 +index 1137c2032b..8fc2b84f52 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -110,8 +110,19 @@ def test_get_path(self): @@ -153,7 +153,7 @@ index b6dbf3d52c..4f06a7673c 100644 os.path.normpath(expected), ) -@@ -335,7 +346,7 @@ def test_get_config_h_filename(self): +@@ -344,7 +355,7 @@ def test_get_config_h_filename(self): self.assertTrue(os.path.isfile(config_h), config_h) def test_get_scheme_names(self): @@ -162,7 +162,7 @@ index b6dbf3d52c..4f06a7673c 100644 if HAS_USER_BASE: wanted.extend(['nt_user', 'osx_framework_user', 'posix_user']) self.assertEqual(get_scheme_names(), tuple(sorted(wanted))) -@@ -347,6 +358,8 @@ def test_symlink(self): # Issue 7880 +@@ -356,6 +367,8 @@ def test_symlink(self): # Issue 7880 cmd = "-c", "import sysconfig; print(sysconfig.get_platform())" self.assertEqual(py.call_real(*cmd), py.call_link(*cmd)) diff --git a/00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch b/00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch index 7146a82..2392a78 100644 --- a/00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch +++ b/00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch @@ -16,10 +16,10 @@ https://github.com/GrahamDumpleton/mod_wsgi/issues/730 2 files changed, 8 insertions(+), 50 deletions(-) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py -index 00d9e591c7..3314319fec 100644 +index 2e4b860b97..3066b23ee1 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py -@@ -1089,39 +1089,6 @@ def noop(): pass +@@ -1100,39 +1100,6 @@ def noop(): pass threading.Thread(target=noop).start() # Thread.join() is not called @@ -56,9 +56,9 @@ index 00d9e591c7..3314319fec 100644 - self.assertEqual(out, b'') - self.assertEqual(err, b'') - - def test_start_new_thread_at_exit(self): + def test_start_new_thread_at_finalization(self): code = """if 1: - import atexit + import _thread diff --git a/Lib/threading.py b/Lib/threading.py index 98cb43c697..ee647f8549 100644 --- a/Lib/threading.py diff --git a/00415-cve-2023-27043-gh-102988-reject-malformed-addresses-in-email-parseaddr-111116.patch b/00415-cve-2023-27043-gh-102988-reject-malformed-addresses-in-email-parseaddr-111116.patch index 352fef8..192c8b7 100644 --- a/00415-cve-2023-27043-gh-102988-reject-malformed-addresses-in-email-parseaddr-111116.patch +++ b/00415-cve-2023-27043-gh-102988-reject-malformed-addresses-in-email-parseaddr-111116.patch @@ -255,7 +255,7 @@ index aa949aa933..af2fb14754 100644 diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py -index 2a237095b9..4672b790d8 100644 +index a373c53c7c..c616398eb1 100644 --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -16,6 +16,7 @@ @@ -266,7 +266,7 @@ index 2a237095b9..4672b790d8 100644 from email.charset import Charset from email.generator import Generator, DecodedGenerator, BytesGenerator -@@ -3337,15 +3338,137 @@ def test_getaddresses_comma_in_name(self): +@@ -3352,15 +3353,137 @@ def test_getaddresses_comma_in_name(self): ], ) @@ -412,7 +412,7 @@ index 2a237095b9..4672b790d8 100644 def test_getaddresses_embedded_comment(self): """Test proper handling of a nested comment""" -@@ -3536,6 +3659,54 @@ def test_mime_classes_policy_argument(self): +@@ -3551,6 +3674,54 @@ def test_mime_classes_policy_argument(self): m = cls(*constructor, policy=email.policy.default) self.assertIs(m.policy, email.policy.default) diff --git a/00418-don-t-generate-sbom-in-make-regen-all.patch b/00418-don-t-generate-sbom-in-make-regen-all.patch deleted file mode 100644 index d41da28..0000000 --- a/00418-don-t-generate-sbom-in-make-regen-all.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Karolina Surma -Date: Thu, 8 Feb 2024 15:53:26 +0100 -Subject: [PATCH] 00418: Don't generate sbom in make regen-all -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The script and make target, added in Python 3.12.2, assumes a fixed -location of pip wheel and other bundled libraries, resulting in an -error and failed build when not found. -Reported upstream: https://github.com/python/cpython/issues/114240 -and https://github.com/python/cpython/issues/114244 - -Co-Authored-By: Tomáš Hrnčiar ---- - Makefile.pre.in | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/Makefile.pre.in b/Makefile.pre.in -index dd5e69f7ab..40097647b5 100644 ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -1320,9 +1320,10 @@ regen-limited-abi: all - regen-all: regen-cases regen-opcode regen-opcode-targets regen-typeslots \ - regen-token regen-ast regen-keyword regen-sre regen-frozen \ - regen-pegen-metaparser regen-pegen regen-test-frozenmain \ -- regen-test-levenshtein regen-global-objects regen-sbom -+ regen-test-levenshtein regen-global-objects - @echo -- @echo "Note: make regen-stdlib-module-names and make regen-configure should be run manually" -+ @echo "Note: make regen-stdlib-module-names, make regen-configure and make regen-sbom " -+ @echo "should be run manually" - - ############################################################################ - # Special rules for object files diff --git a/00422-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch b/00422-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch new file mode 100644 index 0000000..59637d8 --- /dev/null +++ b/00422-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch @@ -0,0 +1,63 @@ +From 60d40d7095983e0bc23a103b2050adc519dc7fe3 Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Fri, 3 May 2024 14:17:48 +0200 +Subject: [PATCH] Expect failures in tests not working properly with expat with + a fixed CVE in RHEL + +--- + Lib/test/test_pyexpat.py | 1 + + Lib/test/test_sax.py | 1 + + Lib/test/test_xml_etree.py | 3 +++ + 3 files changed, 5 insertions(+) + +diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py +index 43cbd27..27b1502 100644 +--- a/Lib/test/test_pyexpat.py ++++ b/Lib/test/test_pyexpat.py +@@ -793,6 +793,7 @@ class ReparseDeferralTest(unittest.TestCase): + + self.assertEqual(started, ['doc']) + ++ @unittest.expectedFailure + def test_reparse_deferral_disabled(self): + started = [] + +diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py +index 9b3014a..646c92d 100644 +--- a/Lib/test/test_sax.py ++++ b/Lib/test/test_sax.py +@@ -1240,6 +1240,7 @@ class ExpatReaderTest(XmlTestBase): + + self.assertEqual(result.getvalue(), start + b"") + ++ @unittest.expectedFailure + def test_flush_reparse_deferral_disabled(self): + result = BytesIO() + xmlgen = XMLGenerator(result) +diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py +index 9c382d1..62f2871 100644 +--- a/Lib/test/test_xml_etree.py ++++ b/Lib/test/test_xml_etree.py +@@ -1424,9 +1424,11 @@ class XMLPullParserTest(unittest.TestCase): + self.assert_event_tags(parser, [('end', 'root')]) + self.assertIsNone(parser.close()) + ++ @unittest.expectedFailure + def test_simple_xml_chunk_1(self): + self.test_simple_xml(chunk_size=1, flush=True) + ++ @unittest.expectedFailure + def test_simple_xml_chunk_5(self): + self.test_simple_xml(chunk_size=5, flush=True) + +@@ -1651,6 +1653,7 @@ class XMLPullParserTest(unittest.TestCase): + + self.assert_event_tags(parser, [('end', 'doc')]) + ++ @unittest.expectedFailure + def test_flush_reparse_deferral_disabled(self): + parser = ET.XMLPullParser(events=('start', 'end')) + +-- +2.44.0 + diff --git a/00422-gh-115133-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch b/00422-gh-115133-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch deleted file mode 100644 index a395e17..0000000 --- a/00422-gh-115133-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Serhiy Storchaka -Date: Sun, 11 Feb 2024 12:08:39 +0200 -Subject: [PATCH] 00422: gh-115133: Fix tests for XMLPullParser with Expat - 2.6.0 - -Feeding the parser by too small chunks defers parsing to prevent -CVE-2023-52425. Future versions of Expat may be more reactive. - -(cherry picked from commit 4a08e7b3431cd32a0daf22a33421cd3035343dc4) ---- - Lib/test/test_xml_etree.py | 58 ++++++++++++------- - ...-02-08-14-21-28.gh-issue-115133.ycl4ko.rst | 2 + - 2 files changed, 38 insertions(+), 22 deletions(-) - create mode 100644 Misc/NEWS.d/next/Library/2024-02-08-14-21-28.gh-issue-115133.ycl4ko.rst - -diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py -index b50898f1d1..6fb888cb21 100644 ---- a/Lib/test/test_xml_etree.py -+++ b/Lib/test/test_xml_etree.py -@@ -1400,28 +1400,37 @@ class XMLPullParserTest(unittest.TestCase): - self.assertEqual([(action, elem.tag) for action, elem in events], - expected) - -- def test_simple_xml(self): -- for chunk_size in (None, 1, 5): -- with self.subTest(chunk_size=chunk_size): -- parser = ET.XMLPullParser() -- self.assert_event_tags(parser, []) -- self._feed(parser, "\n", chunk_size) -- self.assert_event_tags(parser, []) -- self._feed(parser, -- "\n text\n", chunk_size) -- self.assert_event_tags(parser, [('end', 'element')]) -- self._feed(parser, "texttail\n", chunk_size) -- self._feed(parser, "\n", chunk_size) -- self.assert_event_tags(parser, [ -- ('end', 'element'), -- ('end', 'empty-element'), -- ]) -- self._feed(parser, "\n", chunk_size) -- self.assert_event_tags(parser, [('end', 'root')]) -- self.assertIsNone(parser.close()) -+ def test_simple_xml(self, chunk_size=None): -+ parser = ET.XMLPullParser() -+ self.assert_event_tags(parser, []) -+ self._feed(parser, "\n", chunk_size) -+ self.assert_event_tags(parser, []) -+ self._feed(parser, -+ "\n text\n", chunk_size) -+ self.assert_event_tags(parser, [('end', 'element')]) -+ self._feed(parser, "texttail\n", chunk_size) -+ self._feed(parser, "\n", chunk_size) -+ self.assert_event_tags(parser, [ -+ ('end', 'element'), -+ ('end', 'empty-element'), -+ ]) -+ self._feed(parser, "\n", chunk_size) -+ self.assert_event_tags(parser, [('end', 'root')]) -+ self.assertIsNone(parser.close()) -+ -+ @unittest.expectedFailure -+ def test_simple_xml_chunk_1(self): -+ self.test_simple_xml(chunk_size=1) -+ -+ @unittest.expectedFailure -+ def test_simple_xml_chunk_5(self): -+ self.test_simple_xml(chunk_size=5) -+ -+ def test_simple_xml_chunk_22(self): -+ self.test_simple_xml(chunk_size=22) - - def test_feed_while_iterating(self): - parser = ET.XMLPullParser() -diff --git a/Misc/NEWS.d/next/Library/2024-02-08-14-21-28.gh-issue-115133.ycl4ko.rst b/Misc/NEWS.d/next/Library/2024-02-08-14-21-28.gh-issue-115133.ycl4ko.rst -new file mode 100644 -index 0000000000..6f1015235c ---- /dev/null -+++ b/Misc/NEWS.d/next/Library/2024-02-08-14-21-28.gh-issue-115133.ycl4ko.rst -@@ -0,0 +1,2 @@ -+Fix tests for :class:`~xml.etree.ElementTree.XMLPullParser` with Expat -+2.6.0. diff --git a/00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch b/00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch new file mode 100644 index 0000000..ea2df3a --- /dev/null +++ b/00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Karolina Surma +Date: Wed, 10 Apr 2024 15:35:04 +0200 +Subject: [PATCH] 00425: Only check for 'test/wheeldata' when it's actually + used + +We build Python in Fedora 39+ with option `--with-wheel-pkg-dir` +pointing to a custom wheel directory and delete the contents of +upstream's `test/wheeldata`. Don't include the directory in the test set +if the wheels are used from a different location. +--- + Lib/test/test_tools/test_makefile.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Lib/test/test_tools/test_makefile.py b/Lib/test/test_tools/test_makefile.py +index 17a1a6d0d3..9ce874033d 100644 +--- a/Lib/test/test_tools/test_makefile.py ++++ b/Lib/test/test_tools/test_makefile.py +@@ -66,6 +66,9 @@ def test_makefile_test_folders(self): + ) + used.append(relpath) + ++ if sysconfig.get_config_var('WHEEL_PKG_DIR'): ++ test_dirs.remove('test/wheeldata') ++ + # Check that there are no extra entries: + unique_test_dirs = set(test_dirs) + self.assertSetEqual(unique_test_dirs, set(used)) diff --git a/python3.12.spec b/python3.12.spec index b7e5889..b0016d3 100644 --- a/python3.12.spec +++ b/python3.12.spec @@ -16,11 +16,11 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well -%global general_version %{pybasever}.2 +%global general_version %{pybasever}.3 #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 3%{?dist} +Release: 1%{?dist} License: Python-2.0.1 @@ -386,22 +386,21 @@ Patch397: 00397-tarfile-filter.patch # Thomas Dwyer. Patch415: 00415-cve-2023-27043-gh-102988-reject-malformed-addresses-in-email-parseaddr-111116.patch -# 00418 # 153905265371131e1227ace0dfef34a5c5efde59 -# Don't generate sbom in make regen-all -# -# The script and make target, added in Python 3.12.2, assumes a fixed -# location of pip wheel and other bundled libraries, resulting in an -# error and failed build when not found. -# Reported upstream: https://github.com/python/cpython/issues/114240 -# and https://github.com/python/cpython/issues/114244 -Patch418: 00418-don-t-generate-sbom-in-make-regen-all.patch - # 00422 # a353cebef737c41420dc7ae2469dd657371b8881 -# gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 +# Fix tests for XMLPullParser with Expat 2.6.0 # # Feeding the parser by too small chunks defers parsing to prevent # CVE-2023-52425. Future versions of Expat may be more reactive. -Patch422: 00422-gh-115133-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch +Patch422: 00422-fix-tests-for-xmlpullparser-with-expat-2-6-0.patch + +# 00425 # a563ac3076a00f0f48b3f94ff63d91d37cb4f1e9 +# Only check for 'test/wheeldata' when it's actually used +# +# We build Python in Fedora 39+ with option `--with-wheel-pkg-dir` +# pointing to a custom wheel directory and delete the contents of +# upstream's `test/wheeldata`. Don't include the directory in the test set +# if the wheels are used from a different location. +Patch425: 00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch # (New patches go here ^^^) # @@ -1714,6 +1713,10 @@ CheckPython optimized # ====================================================== %changelog +* Fri May 03 2024 Lumír Balhar - 3.12.3-1 +- Update to 3.12.3 +Related: RHEL-33690 + * Fri May 03 2024 Lumír Balhar - 3.12.2-3 - Move all test modules to the python3-test package, namely: - __phello__ diff --git a/sources b/sources index 2c3fe1d..a31bb26 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (Python-3.12.2.tar.xz) = 2ccfae7b9f95d8e15ea85d3f66eea5f6a8fdcaffc0b405095fecb33efc0df50b831c1215542910ced948b54e6de1f7242b0b8b9afc5f89079451c552430d7d9f -SHA512 (Python-3.12.2.tar.xz.asc) = fb477acb49864a662b1586db79e80fd8ebab85d4e5e14acd3bfb5afc3dbe8d6b9bf97eb518dfb77662e27040d400f451ed7575fe1264a6cc0d9feb06e4f2dc84 +SHA512 (Python-3.12.3.tar.xz) = 4a2213b108e7f1f1525baa8348e68b2a2336d925e60d0a59f0225fc470768a2c8031edafc0b8243f94dbae18afda335ee5adf2785328c2218fd64cbb439f13a4 +SHA512 (Python-3.12.3.tar.xz.asc) = c291ec5b5e4f8deba867cc517624dd9a174745f04061ef737e58f3d52b9b30318264aec350e339fe88ccb493809ca1a90a378e86d86b8ec4a4f578b1a5843624