Issue 1719898: tarfile stops expanding with long filenames

Created on 2007-05-16 09:32 by zagy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tarfile.patch zagy, 2007-05-16 09:32 Fix for the 100 char bug.
Messages (4)
msg32013 - (view) Author: Christian Zagrodnick (zagy) Date: 2007-05-16 09:32
The tarfile module fixes an issue with "Some old tar programs represent a directory as a regular file with a trailing slash.":

    if tarinfo.isreg() and tarinfo.name.endswith("/"):
        tarinfo.type = DIRTYPE

*After* that the full filename is composed. The chars >100 are stored in "prefix":

    if tarinfo.type != GNUTYPE_SPARSE:
        tarinfo.name normpath(os.path.join(nts(tarinfo.prefix), tarinfo.name))


So guess what happens if you filename has a / at the 100th character. Right, its considered a directory. Since directories have no data, the next metadata block is read from your file data which fails in various ways.

Patch attached.
msg32014 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2007-05-16 13:32
Did you also test Python 2.5? If this error occurs with that version too (which it should not), please attach a small test tar archive to this tracker item.

Python 2.4 is no longer maintained, sorry.
msg32015 - (view) Author: Christian Zagrodnick (zagy) Date: 2007-05-25 11:15
Ok, from looking at the code it should work in Python 2.5. I shipped around the  Python 2.4 bug by creating a zip release instead of tar. 

Pity that Python 2.4 is no longer maintained though. I guess we need to bump Zope 3 pretty soon then :)
msg32016 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2007-05-26 08:08
Okay, I close this bug then.
History
Date User Action Args
2022-04-11 14:56:24adminsetgithub: 44956
2007-05-16 09:32:20zagycreate