[Patches] [ python-Patches-1029061 ] tarfile.py longnames are
truncated in getnames()
SourceForge.net
noreply at sourceforge.net
Thu Sep 16 10:44:18 CEST 2004
Patches item #1029061, was opened at 2004-09-16 10:44
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1029061&group_id=5470
Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Lars Gustäbel (gustaebel)
Assigned to: Nobody/Anonymous (nobody)
Summary: tarfile.py longnames are truncated in getnames()
Initial Comment:
When a TarFile object reads a tar archive, it scans
through the headers, converts them into TarInfo objects
and adds them to the internal data structures:
self.members.append(tarinfo)
self.membernames.append(tarinfo.name)
When a GNU longname member is processed, it is added at
a point in time when its name attribute has not yet
been replaced with the longname, so longnames in
self.membernames are truncated and therefore unusable.
This problem could have been fixed with a quick/dirty
hack. But I decided to remove self.membernames
completely because it is redundant. getnames() which
was the public interface to it now generates a list
on-the-fly from the list of members, so it always
reflects the actual state.
I encountered another small bug on the way. The docs
for TarFile.getmember() state: "If a member occurs more
than once in the archive, its last occurence is assumed
to be the most up-to-date version."
It was never implemented like that, so I fixed it, too.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1029061&group_id=5470
More information about the Patches
mailing list