Issue 721871: tarfile gets filenames wrong (original) (raw)

Created on 2003-04-15 14:56 by jackjansen, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Messages (5)
msg15472 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-04-15 14:56
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.
msg15473 - (view) Author: Sjoerd Mullender (sjoerd) * (Python committer) Date: 2003-04-15 15:13
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. :-( )
msg15474 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-04-16 09:26
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>.
msg15475 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-04-22 12:04
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.
msg15476 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-04-22 22:03
Logged In: YES user_id=45365 Fixed in tarfile.py ref 1.8
History
Date User Action Args
2022-04-10 16:08:09 admin set github: 38307
2003-04-15 14:56:59 jackjansen create