|
|
b9ffd2 |
commit 86ed41792d394f804d2c9e695ac8b257220fbdee
|
|
|
b9ffd2 |
Author: Victor Stinner <vstinner@redhat.com>
|
|
|
b9ffd2 |
Date: Tue Mar 12 17:17:13 2019 +0100
|
|
|
b9ffd2 |
|
|
|
b9ffd2 |
Fix test_tarfile on ppc64
|
|
|
b9ffd2 |
|
|
|
b9ffd2 |
Fix sparse file tests of test_tarfile on ppc64le with the tmpfs
|
|
|
b9ffd2 |
filesystem.
|
|
|
b9ffd2 |
|
|
|
b9ffd2 |
* https://bugzilla.redhat.com/show_bug.cgi?id=1639490
|
|
|
b9ffd2 |
* https://bugs.python.org/issue35772
|
|
|
b9ffd2 |
* https://github.com/python/cpython/commit/d1dd6be613381b996b9071443ef081de8e5f3aff
|
|
|
b9ffd2 |
|
|
|
b9ffd2 |
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
|
|
|
b9ffd2 |
index 4cd7d53..bd8b05f 100644
|
|
|
b9ffd2 |
--- a/Lib/test/test_tarfile.py
|
|
|
b9ffd2 |
+++ b/Lib/test/test_tarfile.py
|
|
|
b9ffd2 |
@@ -973,16 +973,21 @@ class GNUReadTest(LongnameTest, ReadTest, unittest.TestCase):
|
|
|
b9ffd2 |
def _fs_supports_holes():
|
|
|
b9ffd2 |
# Return True if the platform knows the st_blocks stat attribute and
|
|
|
b9ffd2 |
# uses st_blocks units of 512 bytes, and if the filesystem is able to
|
|
|
b9ffd2 |
- # store holes in files.
|
|
|
b9ffd2 |
+ # store holes of 4 KiB in files.
|
|
|
b9ffd2 |
+ #
|
|
|
b9ffd2 |
+ # The function returns False if page size is larger than 4 KiB.
|
|
|
b9ffd2 |
+ # For example, ppc64 uses pages of 64 KiB.
|
|
|
b9ffd2 |
if sys.platform.startswith("linux"):
|
|
|
b9ffd2 |
# Linux evidentially has 512 byte st_blocks units.
|
|
|
b9ffd2 |
name = os.path.join(TEMPDIR, "sparse-test")
|
|
|
b9ffd2 |
with open(name, "wb") as fobj:
|
|
|
b9ffd2 |
+ # Seek to "punch a hole" of 4 KiB
|
|
|
b9ffd2 |
fobj.seek(4096)
|
|
|
b9ffd2 |
+ fobj.write(b'x' * 4096)
|
|
|
b9ffd2 |
fobj.truncate()
|
|
|
b9ffd2 |
s = os.stat(name)
|
|
|
b9ffd2 |
support.unlink(name)
|
|
|
b9ffd2 |
- return s.st_blocks == 0
|
|
|
b9ffd2 |
+ return (s.st_blocks * 512 < s.st_size)
|
|
|
b9ffd2 |
else:
|
|
|
b9ffd2 |
return False
|
|
|
b9ffd2 |
|