From b1c7775af77a3a67c46933f26a6d3db6bbb7f450 Mon Sep 17 00:00:00 2001 From: Miro HronĨok Date: Jan 30 2020 16:50:12 +0000 Subject: Fix test_zipfile.test_add_file_after_2107() --- diff --git a/00341-bpo-39460.patch b/00341-bpo-39460.patch new file mode 100644 index 0000000..93dde5f --- /dev/null +++ b/00341-bpo-39460.patch @@ -0,0 +1,41 @@ +From c6af8adc44bf6b53ac3b875fe1f644c05a990d2a Mon Sep 17 00:00:00 2001 +From: Victor Stinner +Date: Wed, 29 Jan 2020 15:23:29 +0100 +Subject: [PATCH] 00341: bpo-39460: Fix test_zipfile.test_add_file_after_2107() + +XFS filesystem is limited to 32-bit timestamp, but the utimensat() +syscall doesn't fail. Moreover, there is a VFS bug which returns +a cached timestamp which is different than the value on disk. + +https://bugzilla.redhat.com/show_bug.cgi?id=1795576 +https://bugs.python.org/issue39460#msg360952 +--- + Lib/test/test_zipfile.py | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py +index f03c044eae..0737c343cb 100644 +--- a/Lib/test/test_zipfile.py ++++ b/Lib/test/test_zipfile.py +@@ -602,6 +602,18 @@ class StoredTestsWithSourceFile(AbstractTestsWithSourceFile, + except OverflowError: + self.skipTest('Host fs cannot set timestamp to required value.') + ++ mtime_ns = os.stat(TESTFN).st_mtime_ns ++ if mtime_ns != (4386268800 * 10**9): ++ # XFS filesystem is limited to 32-bit timestamp, but the syscall ++ # didn't fail. Moreover, there is a VFS bug which returns ++ # a cached timestamp which is different than the value on disk. ++ # ++ # Test st_mtime_ns rather than st_mtime to avoid rounding issues. ++ # ++ # https://bugzilla.redhat.com/show_bug.cgi?id=1795576 ++ # https://bugs.python.org/issue39460#msg360952 ++ self.skipTest(f"Linux VFS/XFS kernel bug detected: {mtime_ns=}") ++ + with zipfile.ZipFile(TESTFN2, "w") as zipfp: + self.assertRaises(struct.error, zipfp.write, TESTFN) + +-- +2.24.1 + diff --git a/python3.spec b/python3.spec index aab95f0..038e32d 100644 --- a/python3.spec +++ b/python3.spec @@ -295,6 +295,15 @@ Patch328: 00328-pyc-timestamp-invalidation-mode.patch # Fixed upstream: https://bugs.python.org/issue16575 Patch339: 00339-bpo-16575.patch +# 00341 # +# Fix test_zipfile.test_add_file_after_2107() +# XFS filesystem is limited to 32-bit timestamp, but the utimensat() +# syscall doesn't fail. Moreover, there is a VFS bug which returns +# a cached timestamp which is different than the value on disk. +# Workarounds https://bugzilla.redhat.com/show_bug.cgi?id=1795576 +# Workarounded upstream: https://bugs.python.org/issue39460 +Patch341: 00341-bpo-39460.patch + # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -643,6 +652,7 @@ rm Lib/ensurepip/_bundled/*.whl %patch274 -p1 %patch328 -p1 %patch339 -p1 +%patch341 -p1 # Remove files that should be generated by the build