Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python for openSUSE:Factory checked in at 2022-09-16 13:32:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python (Old) and /work/SRC/openSUSE:Factory/.python.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python" Fri Sep 16 13:32:00 2022 rev:173 rq:1003718 version:2.7.18 Changes: -------- --- /work/SRC/openSUSE:Factory/python/python-base.changes 2022-09-10 20:16:39.740731933 +0200 +++ /work/SRC/openSUSE:Factory/.python.new.2083/python-base.changes 2022-09-16 13:32:18.905263723 +0200 @@ -1,0 +2,7 @@ +Tue Sep 13 04:06:02 UTC 2022 - Bernhard Wiedemann <[email protected]> + +- Add bpo34990-2038-problem-compileall.patch making compileall.py + compliant with year 2038 (bsc#1202666, gh#python/cpython#79171), + backport of fix to Python 2.7. + +------------------------------------------------------------------- python-doc.changes: same change python.changes: same change New: ---- bpo34990-2038-problem-compileall.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-base.spec ++++++ --- /var/tmp/diff_new_pack.Rm8oZw/_old 2022-09-16 13:32:20.629269292 +0200 +++ /var/tmp/diff_new_pack.Rm8oZw/_new 2022-09-16 13:32:20.633269305 +0200 @@ -133,6 +133,7 @@ # PATCH-FIX-UPSTREAM CVE-2021-28861 bsc#1202624 # Coerce // to / in Lib/BaseHTTPServer.py Patch71: CVE-2021-28861-double-slash-path.patch +Patch72: bpo34990-2038-problem-compileall.patch # COMMON-PATCH-END %define python_version %(echo %{tarversion} | head -c 3) BuildRequires: automake @@ -270,6 +271,7 @@ %patch69 -p1 %patch70 -p1 %patch71 -p1 +%patch72 -p1 # For patch 66 cp -v %{SOURCE66} Lib/test/recursion.tar ++++++ python-doc.spec ++++++ --- /var/tmp/diff_new_pack.Rm8oZw/_old 2022-09-16 13:32:20.677269447 +0200 +++ /var/tmp/diff_new_pack.Rm8oZw/_new 2022-09-16 13:32:20.681269461 +0200 @@ -132,6 +132,7 @@ # PATCH-FIX-UPSTREAM CVE-2021-28861 bsc#1202624 # Coerce // to / in Lib/BaseHTTPServer.py Patch71: CVE-2021-28861-double-slash-path.patch +Patch72: bpo34990-2038-problem-compileall.patch # COMMON-PATCH-END Provides: pyth_doc = %{version} Provides: pyth_ps = %{version} @@ -207,6 +208,7 @@ %patch69 -p1 %patch70 -p1 %patch71 -p1 +%patch72 -p1 # For patch 66 cp -v %{SOURCE66} Lib/test/recursion.tar ++++++ python.spec ++++++ --- /var/tmp/diff_new_pack.Rm8oZw/_old 2022-09-16 13:32:20.705269538 +0200 +++ /var/tmp/diff_new_pack.Rm8oZw/_new 2022-09-16 13:32:20.709269551 +0200 @@ -132,6 +132,7 @@ # PATCH-FIX-UPSTREAM CVE-2021-28861 bsc#1202624 # Coerce // to / in Lib/BaseHTTPServer.py Patch71: CVE-2021-28861-double-slash-path.patch +Patch72: bpo34990-2038-problem-compileall.patch # COMMON-PATCH-END BuildRequires: automake BuildRequires: db-devel @@ -323,6 +324,7 @@ %patch69 -p1 %patch70 -p1 %patch71 -p1 +%patch72 -p1 # For patch 66 cp -v %{SOURCE66} Lib/test/recursion.tar ++++++ bpo34990-2038-problem-compileall.patch ++++++ >From 9d3b6b2472f7c7ef841e652825de652bc8af85d7 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <[email protected]> Date: Tue, 24 Aug 2021 08:07:31 -0700 Subject: [PATCH] [3.9] bpo-34990: Treat the pyc header's mtime in compileall as an unsigned int (GH-19708) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit bb21e28fd08f894ceff2405544a2f257d42b1354) Co-authored-by: Ammar Askar <[email protected]> Co-authored-by: St??phane Wirtel <[email protected]> ported to python-2.7 by Bernhard M. Wiedemann <bwiedemann suse de> diff --git a/Lib/compileall.py b/Lib/compileall.py index 5cfa8be..193147e 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -85,7 +85,7 @@ def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0): if not force: try: mtime = int(os.stat(fullname).st_mtime) - expect = struct.pack('<4sl', imp.get_magic(), mtime) + expect = struct.pack('<4sL', imp.get_magic(), mtime & 0xFFFFFFFF) cfile = fullname + (__debug__ and 'c' or 'o') with open(cfile, 'rb') as chandle: actual = chandle.read(8) diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py index d3a26db..0907f59 100644 --- a/Lib/test/test_compileall.py +++ b/Lib/test/test_compileall.py @@ -28,7 +28,7 @@ class CompileallTests(unittest.TestCase): with open(self.bc_path, 'rb') as file: data = file.read(8) mtime = int(os.stat(self.source_path).st_mtime) - compare = struct.pack('<4sl', imp.get_magic(), mtime) + compare = struct.pack('<4sL', imp.get_magic(), mtime & 0xFFFFFFFF) return data, compare @unittest.skipUnless(hasattr(os, 'stat'), 'test needs os.stat()') @@ -48,7 +48,7 @@ class CompileallTests(unittest.TestCase): def test_mtime(self): # Test a change in mtime leads to a new .pyc. - self.recreation_check(struct.pack('<4sl', imp.get_magic(), 1)) + self.recreation_check(struct.pack('<4sL', imp.get_magic(), 1)) def test_magic_number(self): # Test a change in mtime leads to a new .pyc. diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index a66738a..e333582 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -27,13 +27,7 @@ raise_src = 'def do_raise(): raise TypeError\n' def make_pyc(co, mtime): data = marshal.dumps(co) - if type(mtime) is type(0.0): - # Mac mtimes need a bit of special casing - if mtime < 0x7fffffff: - mtime = int(mtime) - else: - mtime = int(-0x100000000L + long(mtime)) - pyc = imp.get_magic() + struct.pack("<i", int(mtime)) + data + pyc = imp.get_magic() + struct.pack("<L", int(mtime) & 0xFFFFFFFF) + data return pyc def module_path_to_dotted_name(path): @@ -184,6 +178,14 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase): TESTMOD + pyc_ext: (NOW, badtime_pyc)} self.doTest(".py", files, TESTMOD) + def test2038MTime(self): + # Make sure we can handle mtimes larger than what a 32-bit signed number + # can hold. + twenty_thirty_eight_pyc = make_pyc(test_co, 2**32 - 1) + files = {TESTMOD + ".py": (NOW, test_src), + TESTMOD + pyc_ext: (NOW, twenty_thirty_eight_pyc)} + self.doTest(".py", files, TESTMOD) + def testPackage(self): packdir = TESTPACK + os.sep files = {packdir + "__init__" + pyc_ext: (NOW, test_pyc), ========== Author: Bernhard M. Wiedemann <bwiedemann suse de> Date: 2022-09-13 More y2038 fixes that are only needed for python2.7 diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py index 6515945..21d52bb 100644 --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -128,7 +128,7 @@ class Module(AbstractCompileMode): # to indicate the type of the value. simplest way to get the # same effect is to call marshal and then skip the code. mtime = os.path.getmtime(self.filename) - mtime = struct.pack('<i', mtime) + mtime = struct.pack('<L', mtime & 0xFFFFFFFF) return self.MAGIC + mtime class LocalNameFinder: diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py index cdb1af5..6344ef2 100644 --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -265,7 +265,7 @@ class TestGzip(unittest.TestCase): self.assertEqual(flagsByte, '\x08') # only the FNAME flag is set mtimeBytes = fRead.read(4) - self.assertEqual(mtimeBytes, struct.pack('<i', mtime)) # little-endian + self.assertEqual(mtimeBytes, struct.pack('<L', mtime & 0xFFFFFFFF)) # little-endian xflByte = fRead.read(1) self.assertEqual(xflByte, '\x02') # maximum compression diff --git a/Python/import.c b/Python/import.c index b79354b..3efd17f 100644 --- a/Python/import.c +++ b/Python/import.c @@ -810,7 +810,7 @@ check_compiled_module(char *pathname, time_t mtime, char *cpathname) { FILE *fp; long magic; - long pyc_mtime; + unsigned long pyc_mtime; fp = fopen(cpathname, "rb"); if (fp == NULL) @@ -823,7 +823,7 @@ check_compiled_module(char *pathname, time_t mtime, char *cpathname) return NULL; } pyc_mtime = PyMarshal_ReadLongFromFile(fp); - if (pyc_mtime != mtime) { + if ((pyc_mtime&0xFFFFFFFF) != (((unsigned long)mtime)&0xFFFFFFFF)) { if (Py_VerboseFlag) PySys_WriteStderr("# %s has bad mtime\n", cpathname); fclose(fp);
