[ python-Bugs-1100429 ] TarFile iteration can break (on Windows) if file has links

SourceForge.net noreply at sourceforge.net
Tue Jan 11 21:54:29 CET 2005


Bugs item #1100429, was opened at 2005-01-11 11:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1100429&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Chapman (glchapman)
Assigned to: Nobody/Anonymous (nobody)
Summary: TarFile iteration can break (on Windows) if file has links

Initial Comment:
I ran into this with a simple loop trying to detar
Pyrex-0.9.3:

for info in tarfile:
    tarfile.extract(info)

I called the above immediately after calling
tarfile.open, so the returned iterator was an instance
of TarIter.  The problem is that Pyrex includes some
symbolic links.  When TarFile.makelink finds that
os.symlink is missing (on Windows) it then does
getmember to find the info for the referenced file. 
The getmember method results in a call to getmembers,
which loads all the infos into the members list. 
However, this breaks the TarIter, since it assumes the
members have not yet been loaded.

Not sure what the best fix for this is; in my script, I
switched over to using getmembers rather than the iterator.


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

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


More information about the Python-bugs-list mailing list