[Python-bugs-list] [ python-Bugs-721871 ] tarfile gets filenames wrong

SourceForge.net noreply@sourceforge.net
Tue, 22 Apr 2003 05:04:33 -0700


Bugs item #721871, was opened at 2003-04-15 16:56
Message generated for change (Comment added) made by jackjansen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=721871&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
>Priority: 7
Submitted By: Jack Jansen (jackjansen)
>Assigned to: Jack Jansen (jackjansen)
Summary: tarfile gets filenames wrong

Initial Comment:
Tarfile seem to get filenames wrong, at least some times, at least on 
MacOSX. As an example, take the attached tar file (a distutils bdist-
dumb for OSX) and do 

>>> tf = tarfile.open(..., 'r')
>>> print tf.getnames()

Notice how for many filenames an initial bit of the pathname is 
missing.


----------------------------------------------------------------------

>Comment By: Jack Jansen (jackjansen)
Date: 2003-04-22 14:04

Message:
Logged In: YES 
user_id=45365

After some digging the problem turns out that the prefix field in the file 
header is not completely zero-filled, the very last byte is a '('. Your code 
specifically checks for it being zero-filled. However, if I look up the tar 
standard (www.opengroup.org, unix standard, utilities, pax, somewhere half 
way down is the ustar file format standard) it says the data in the prefix field 
is NUL-terminated, it says nothing about having to be NUL-filled
.

A possible fix would be to simply take prefix up to the first NUL, but I'm 
contacting Lars first to see if he has an opinion.

----------------------------------------------------------------------

Comment By: Jack Jansen (jackjansen)
Date: 2003-04-16 11:26

Message:
Logged In: YES 
user_id=45365

Actually, I did check the box (just this once:-) but sourceforge refused the 
file, probably too big. It can be found at <http://www.cwi.nl/~jack/pimp/
Numeric-22.0.darwin-6.3-Power_Macintosh.tar.gz>.

----------------------------------------------------------------------

Comment By: Sjoerd Mullender (sjoerd)
Date: 2003-04-15 17:13

Message:
Logged In: YES 
user_id=43607

There's no uploaded file!  You have to check the
checkbox labeled "Check to Upload & Attach File"
when you upload a file.

Please try again.

(This is a SourceForge annoyance that we can do
nothing about. :-( )

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=721871&group_id=5470