Skip to content

Commit 3cb49b6

Browse files
authored
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
1 parent 35eac45 commit 3cb49b6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_zipfile.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,18 @@ def test_add_file_after_2107(self):
616616
except OverflowError:
617617
self.skipTest('Host fs cannot set timestamp to required value.')
618618

619+
mtime_ns = os.stat(TESTFN).st_mtime_ns
620+
if mtime_ns != (4386268800 * 10**9):
621+
# XFS filesystem is limited to 32-bit timestamp, but the syscall
622+
# didn't fail. Moreover, there is a VFS bug which returns
623+
# a cached timestamp which is different than the value on disk.
624+
#
625+
# Test st_mtime_ns rather than st_mtime to avoid rounding issues.
626+
#
627+
# https://bugzilla.redhat.com/show_bug.cgi?id=1795576
628+
# https://bugs.python.org/issue39460#msg360952
629+
self.skipTest(f"Linux VFS/XFS kernel bug detected: {mtime_ns=}")
630+
619631
with zipfile.ZipFile(TESTFN2, "w") as zipfp:
620632
self.assertRaises(struct.error, zipfp.write, TESTFN)
621633

0 commit comments

Comments
 (0)