Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionSimone Tiraboschi
2017-09-15 15:52:24 UTC
Description of problem:
According to tar man page:
Device blocking:
-b, --blocking-factor=BLOCKS
BLOCKS x 512 bytes per record
and tar will read and write entire records.
According to tarfile documentation,
tarfile.open(name=None, mode=’r’, fileobj=None, bufsize=10240, **kwargs)
...
bufsize specifies the blocksize and defaults to 20 * 512 bytes
but if I try creating an archive specifying a different blocking factor, tarfile simply ignores and keeps 10240.
The issue can be easily reproduced with this snippet:
import os
import tarfile
import tempfile
EXPECTED_SIZE = 20480
tempdir = tempfile.gettempdir()
fd, _tmp_tar = tempfile.mkstemp(
suffix='.tar',
dir=tempdir,
)
os.close(fd)
tar = tarfile.open(name=_tmp_tar, mode='w', bufsize=EXPECTED_SIZE)
tar.close()
statinfo = os.stat(_tmp_tar)
if statinfo.st_size != EXPECTED_SIZE:
raise RuntimeError((
'Archive size doens\'t match expected size: '
'actual {a} - expected {e}'
).format(
a=statinfo.st_size,
e=EXPECTED_SIZE,
))
Version-Release number of selected component (if applicable):
How reproducible:
python-libs-2.7.5-58.el7.x86_64
Steps to Reproduce:
1. try creating an archive with a custom blocking factor
2.
3.
Actual results:
tarfile.open ignores and keeps 10240 (the default value)
Expected results:
tarfile.open honors the custom blocking factor
Additional info:
tar --blocking-factor=40 -cf test.tar -T /dev/null
works as expected creating an empty tar archive of 20480 (40x512) bytes.
Comment 2Petr Viktorin (pviktori)
2017-10-05 13:41:46 UTC
This is on our radar but we're not sure if we can fit investigating it in the 7.5 devel phase.
Let me know if this is higher priority.
Comment 5Petr Viktorin (pviktori)
2018-04-11 10:18:44 UTC
This is still low priority, let us know if it needs attention now.
Comment 6Petr Viktorin (pviktori)
2018-06-07 14:16:57 UTC
Victor, this is low priority, but one of the things that could use a core dev's attention.
Sadly, in Python, it's not possible to configure the blocking factor. The bufsize parameter is just an optimization for internal data copies, it's unrelated to the blocking factor. I updated the upstream issue as a feature request: https://bugs.python.org/issue31774
Comment 9Petr Viktorin (pviktori)
2018-08-02 13:36:19 UTC
We will not fix this in Python 2.
Please re-open if that's a problem.
Description of problem: According to tar man page: Device blocking: -b, --blocking-factor=BLOCKS BLOCKS x 512 bytes per record and tar will read and write entire records. According to tarfile documentation, tarfile.open(name=None, mode=’r’, fileobj=None, bufsize=10240, **kwargs) ... bufsize specifies the blocksize and defaults to 20 * 512 bytes but if I try creating an archive specifying a different blocking factor, tarfile simply ignores and keeps 10240. The issue can be easily reproduced with this snippet: import os import tarfile import tempfile EXPECTED_SIZE = 20480 tempdir = tempfile.gettempdir() fd, _tmp_tar = tempfile.mkstemp( suffix='.tar', dir=tempdir, ) os.close(fd) tar = tarfile.open(name=_tmp_tar, mode='w', bufsize=EXPECTED_SIZE) tar.close() statinfo = os.stat(_tmp_tar) if statinfo.st_size != EXPECTED_SIZE: raise RuntimeError(( 'Archive size doens\'t match expected size: ' 'actual {a} - expected {e}' ).format( a=statinfo.st_size, e=EXPECTED_SIZE, )) Version-Release number of selected component (if applicable): How reproducible: python-libs-2.7.5-58.el7.x86_64 Steps to Reproduce: 1. try creating an archive with a custom blocking factor 2. 3. Actual results: tarfile.open ignores and keeps 10240 (the default value) Expected results: tarfile.open honors the custom blocking factor Additional info: tar --blocking-factor=40 -cf test.tar -T /dev/null works as expected creating an empty tar archive of 20480 (40x512) bytes.