[ python-Bugs-690341 ] tarfile fails on MacOS9

SourceForge.net noreply at sourceforge.net
Sat Jun 5 18:17:41 EDT 2004

Bugs item #690341, was opened at 2003-02-20 17:21
Message generated for change (Settings changed) made by akuchling
You can respond by visiting: 

Category: Python Library
Group: None
>Status: Closed
>Resolution: Out of Date
Priority: 3
Submitted By: Jack Jansen (jackjansen)
Assigned to: Nobody/Anonymous (nobody)
Summary: tarfile fails on MacOS9

Initial Comment:
test_tarfile fails in MacPython-OS9. The problem seems to be pathname-related, and I'm not sure whether the problem is with the test or with the tarfile module itself.

Various of the tests (test_seek, test_readlines) expect to find a file called, for example, "0-REGTYPE-TEXT", while the archive holds a file "/0-REGTYPE-TEXT". Apparently the tarfile module has some support for os.sep being different than "/", but not enough.

An added problem (or maybe the only problem?) may be that on the mac there are no files at the "root", only directories (disks, actually). So while "/tmp" is representable as "tmp:" this doesn't really work for files as they would be interpreted as directories.


>Comment By: A.M. Kuchling (akuchling)
Date: 2004-06-05 18:17

Logged In: YES 

Given that MacOS 9 support is gone, I'll close this bug.


Comment By: Jack Jansen (jackjansen)
Date: 2003-03-07 08:51

Logged In: YES 

The problem turns out to be deeper: the way tarfile handles pathnames needs work (and probably a lot of it). There is an assumption all over the code that you can convert unix pathnames to native pathnames by simply substitution / with os.path.sep. This will not fly for the Mac: /unix/path/name -> unix:path:name and relative/unix/path -> :relative:unix:path.

I've rigger tarfile.py to raise ImportError on the mac, changed the summary of this bug and left it open/unassigned with a lower priority. Maybe someone finds the time to fix it, some time.


Comment By: Neal Norwitz (nnorwitz)
Date: 2003-02-23 17:05

Logged In: YES 

Jack, I don't really know how to fix these.  My guess is
that doing something like os.path.normpath or abspath on the
names would help.  The code in test_seek and test_readlines
does this:

  file(os.path.join(dirname(), filename), "r")

Could that be changed to:

  file(os.path.normpath(os.path.join(dirname(), filename)), "r")

Perhaps, there should be a utility function to get the
normalized name?  I can try to make the changes, but can't
build or test on MacOS 9.  If you can suggest some changes,
I can make a patch for you to try.


You can respond by visiting: 

More information about the Python-bugs-list mailing list