[Patches] [ python-Patches-1484695 ] tarfile.py fix for #1471427 and updates
SourceForge.net
noreply at sourceforge.net
Thu May 18 00:25:34 CEST 2006
Patches item #1484695, was opened at 2006-05-09 09:51
Message generated for change (Comment added) made by jimjjewett
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1484695&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Lars Gustäbel (gustaebel)
Assigned to: Nobody/Anonymous (nobody)
Summary: tarfile.py fix for #1471427 and updates
Initial Comment:
I have assembled a patch that adds some features from
my own development path of tarfile.py
(http://www.gustaebel.de/lars/tarfile/) and fixes
#1471427 which made some restructuring necessary. The
patch affects Lib/tarfile.py, Lib/test/test_tarfile.py
and Doc/lib/libtarfile.tex.
The changes the patch makes are as follows:
Sets the version to 0.8.0.
Support for base256 encoding of number fields (nti()
and itn()). Up to now this was hardcoded for the
filesize field to allow filesizes greater than 8 GB but
it is applicable to all number fields.
TarInfo.tobuf() has a boolean argument "posix" which
controls how number fields are written (base256 is
non-posix).
Both unsigned and signed (Sun and NeXT) checksums are
calculated. Header validation moves from TarFile.next()
to TarInfo.frombuf(). A header is valid only if its
checksum is okay, in the past the checksum was
calculated but ignored.
The TarFile.next() method was rearranged which makes
header processing clearer and more abstract and fixes
bug #1471427. However, this change breaks the interface
for subclassing in order to implement custom member
types but makes it much easier at the same time. The
mapping TYPE_METH was removed.
A new test ReadGNULongTest was added to test_tarfile.py
and testtar.tar was updated to be able to test the GNU
extensions LONGNAME and LONGLINK.
----------------------------------------------------------------------
Comment By: Jim Jewett (jimjjewett)
Date: 2006-05-17 18:25
Message:
Logged In: YES
user_id=764593
(1) Why change the exception style?
When raising an instance, the style guide (PEP-8, http://
www.python.org/dev/peps/pep-0008/) prefers to construct
that instance; the older form is left over from String
exceptions and will be removed in Python 3.
I could understand leaving them as they were, but if you're
going to change them to make them consistent, why not use
the current format?
(2) Why get rid of the debug messages (such as the
checksum check) entirely? Guarding them in if self.debug,
I would understand.
(3) I wouldn't count on str(e) (where e is any ValueError
instance) being as meaningful as the (current version's)
ReadError("empty, unreadable or compressed file")
----------------------------------------------------------------------
Comment By: Georg Brandl (gbrandl)
Date: 2006-05-10 12:26
Message:
Logged In: YES
user_id=849994
Thanks for the patch, applied as rev. 45954.
----------------------------------------------------------------------
Comment By: Lars Gustäbel (gustaebel)
Date: 2006-05-09 09:52
Message:
Logged In: YES
user_id=642936
Here is testtar.tar to replace Lib/test/testtar.tar.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1484695&group_id=5470
More information about the Patches
mailing list