STINNER Victor <[email protected]> added the comment:
Extract of tartest.py:
tarfile.open(name=_tmp_tar, mode='w', bufsize=EXPECTED_SIZE)
Hum, the bufsize argument only applies to the "...|compression" modes (ex:
"w|gz"). Moreover, it shouldn't change the size of the tarfile, it only changes
the size of parameters of read() and write() arguments.
Extract of Stream.__write():
while len(self.buf) > self.bufsize:
self.fileobj.write(self.buf[:self.bufsize])
self.buf = self.buf[self.bufsize:]
> Trying to create an archive with the tarfile module, by specifying a
> different blocking factor, (...)
I didn't know that we can change the "blocking factor". In the UNIX tar
command, I see the -b option:
-b, --blocking-factor=BLOCKS
Set record size to BLOCKSx512 bytes.
In Lib/tarfile.py, I see:
BLOCKSIZE = 512 # length of processing blocks
RECORDSIZE = BLOCKSIZE * 20 # length of records
So values are hardcoded in Python.
So this issue is a feature request, not a bug report :-)
----------
nosy: +vstinner
title: tarfile.open ignores custom bufsize value when creating a new archive ->
[RFE] tarfile: add an option to change the "blocking factor"
type: -> enhancement
versions: +Python 3.8 -Python 2.7, Python 3.6, Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31774>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com