[Python-checkins] bpo-39460: Fix test_zipfile.test_add_file_after_2107() (GH-18247)

Victor Stinner webhook-mailer at python.org
Wed Jan 29 09:23:37 EST 2020


https://github.com/python/cpython/commit/3cb49b62e61208efcefbc04414e769fc173f205d
commit: 3cb49b62e61208efcefbc04414e769fc173f205d
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-01-29T15:23:29+01:00
summary:

bpo-39460: Fix test_zipfile.test_add_file_after_2107() (GH-18247)

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

files:
M Lib/test/test_zipfile.py

diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 66f05ac1f3aef..4c20bfd7e2cd7 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -616,6 +616,18 @@ def test_add_file_after_2107(self):
         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)
 



More information about the Python-checkins mailing list