summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-01-29 14:41:49 (GMT)
committerGitHub <noreply@github.com>2020-01-29 14:41:49 (GMT)
commit2b675f0c8fd96f61977f6dc636f44fbd5587b6b3 (patch)
treeff1e90f7de1f6897107236d740b3474f2365e0e3
parentd1fa90584f5f4bb0c47743d88a6520ba40e846a0 (diff)
downloadcpython-2b675f0c8fd96f61977f6dc636f44fbd5587b6b3.zip
cpython-2b675f0c8fd96f61977f6dc636f44fbd5587b6b3.tar.gz
cpython-2b675f0c8fd96f61977f6dc636f44fbd5587b6b3.tar.bz2
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/issue39460GH-msg360952 (cherry picked from commit 3cb49b62e61208efcefbc04414e769fc173f205d) Co-authored-by: Victor Stinner <vstinner@python.org>
-rw-r--r--Lib/test/test_zipfile.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index f03c044..0737c34 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)