[Patches] [ python-Patches-651082 ] tarfile module implementation

noreply@sourceforge.net noreply@sourceforge.net
Sun, 22 Dec 2002 16:24:52 -0800


Patches item #651082, was opened at 2002-12-09 15:51
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=651082&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Lars Gustäbel (gustaebel)
Assigned to: Nobody/Anonymous (nobody)
Summary: tarfile module implementation

Initial Comment:
The tarfile module provides a comprehensive interface
to tar archive files with transparent gzip and bzip2
compression. The attachment includes tarfile.py itself,
the documentation and the tests.

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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-12-22 19:24

Message:
Logged In: YES 
user_id=33168

One additional note, Guido asked on python-dev on Dec 12:

  Is there any chance that this can be contributed to the
PSF under the standard PSF license?

I don't remember seeing an answer.

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-12-22 19:14

Message:
Logged In: YES 
user_id=33168

The code looks pretty good.  I ran the test on Linux and it
passed.  However, I don't like that testtar.tar has to be in
the local directory.  It would probably be better to allow
this file to be in the Lib/test directory.

I think this would be a good addition to the stdlib.  My
biggest concern is portability issues to win/mac.  Has there
been any testing on these platforms?  In particular, make a
tar file with symlinks, block devices, different users and
try to unpack on win/mac.

In TarFile.open(), where you do:
      filemode, comptype = mode.split(":")
You should add 1 to the call to split:
      filemode, comptype = mode.split(":", 1)

Same deal further down when splitting on '|'

I noticed sometimes you raise an exception when self.closed,
other times just return.  Do you need the self.closed flag?
 Could you use the underlying file-objects behaviour, ie,
assume that the file is open?

Does the normpath/lambda code work on the mac/windows?

In ExFileObject._readsparse(), is the loop likely to be
executed much?  If there is a performance concern here,
suggest you use a list.  Then outside the loop, do a data =
''.join(list) ; size -= len(data).  (You could move the size
-= len(buf) outside the loop, if you get the len(data).)

What does TarFile.list() print, rather than return a list of
strings or something else?

Should TarFile._extract_member() use normpath() instead of
os.path.normpath()?

os.makenod() & os.makedev() are not guaranteed to exist. 
Should there be a try/except AttributeError in
TarFile.makedev()?
Same comment applies to os.geteuid() in chown.

Do the pwd and grp modules work on windows/mac?

Now on to the pychecker warnings :-)

Lib/tarfile.py:950: Parameter (compresslevel) not used
Lib/tarfile.py:1409: Parameter (tarinfo) not used
Lib/tarfile.py:1435: Parameter (tarinfo) not used
Lib/tarfile.py:1878: Module (time) re-imported
Lib/tarfile.py:1898: Parameter (compress_type) not used

The last one Paramter (compress_type) not used may be ok,
not sure about others.

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

Comment By: Lars Gustäbel (gustaebel)
Date: 2002-12-17 09:41

Message:
Logged In: YES 
user_id=642936

I had to fix a small bug in TarFile.bz2open.

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

Comment By: Lars Gustäbel (gustaebel)
Date: 2002-12-09 15:54

Message:
Logged In: YES 
user_id=642936

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=305470&aid=651082&group_id=5470