Bug 2109120

Summary: Tarfile test failure on ppc64le
Product: [Fedora] Fedora Reporter: Petr Viktorin (pviktori) <pviktori>
Component: python3.6Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, dan, lbalhar, mhroncok, python-maint, python-sig, torsava, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-03 12:11:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1071880, 1992484, 2045102    

Description Petr Viktorin (pviktori) 2022-07-20 12:52:34 UTC
A test for unpacking tarballs with sparse files fails on ppc64le on Koschei (Rawhide & f36):

FAIL: test_sparse_file_00 (test.test_tarfile.GNUReadTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.6.15/Lib/test/test_tarfile.py", line 971, in test_sparse_file_00
    self._test_sparse_file("gnu/sparse-0.0")
  File "/builddir/build/BUILD/Python-3.6.15/Lib/test/test_tarfile.py", line 965, in _test_sparse_file
    self.assertLess(s.st_blocks * 512, s.st_size)
AssertionError: 131072 not less than 86016


Note that 131072 is 256*512.
The issue might be in *reporting* allocated blocks, anywhere along the path:
- Python's assumption that st_block is measured in 512b units (AFAICS it should cuse DEV_BSIZE to be portable)
- converting stat.st_block to the Python stat result object
- libc stat()
- kernel/filesystem
- the test logic using some other wrong assumption

Or the issue might be in the actual tarball unpacking.

Comment 2 Dan HorĂ¡k 2022-07-20 14:08:49 UTC
yeah, different kernel page size or different filesystem look as plausible reasons for the failure to me

Comment 4 Victor Stinner 2022-08-02 10:14:46 UTC
> This was fixed in RHEL 8 but not in Fedora :(

Oh sorry, I only fixed the issue in Python upstream and in RHEL. The issue is very specific to test_tarfile on ppc64 with tmpfs filesystem. It's good to backport the fix, it's simple and should repair Koschei :-)