[New-bugs-announce] [issue44495] wrong FNAME in tarfile if tgz extension is used
Maciej Misiak
report at bugs.python.org
Wed Jun 23 02:55:14 EDT 2021
New submission from Maciej Misiak <maciej.mm.misiak at gmail.com>:
This code is incomplete:
def _init_write_gz(self):
...
if self.name.endswith(".gz"):
self.name = self.name[:-3]
# RFC1952 says we must use ISO-8859-1 for the FNAME field.
self.__write(self.name.encode("iso-8859-1", "replace") + NUL)
If it is used in following way '.gz' is stripped properly and FNAME='somefile.tar':
tarfile.open('somefile.tar.gz', 'w:gz')
but with
tarfile.open('somefile.tgz', 'w:gz')
FNAME is incorrectly prepared as somefile.tgz
----------
components: Library (Lib)
messages: 396382
nosy: maciej.mm.misiak
priority: normal
severity: normal
status: open
title: wrong FNAME in tarfile if tgz extension is used
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44495>
_______________________________________
More information about the New-bugs-announce
mailing list