[Patches] [ python-Patches-916874 ] fix for bug #857297 (tarfile and hardlinks)

SourceForge.net noreply at sourceforge.net
Mon Mar 15 15:51:50 EST 2004


Patches item #916874, was opened at 2004-03-15 21:51
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=916874&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Lars Gustäbel (gustaebel)
Assigned to: Nobody/Anonymous (nobody)
Summary: fix for bug #857297 (tarfile and hardlinks)

Initial Comment:
Included is a patch that fixes the extraction of
hardlinks in tarfile.py (bug #857297) and a testcase.

Until now tarfile.py extracted hardlinks the same way
as symlinks which worked under certain circumstances:
if the hardlink source is accessible from the current
working directory everything is fine, but if you choose
to extract it to a different location it won't work.  
    That particular code in tarfile.py dates back to my
good old windoze days where my understanding of unix
filesystem basics was not as profound as it is today :-)

The testcase probably needs some attention regarding
portability. (On platforms that do not have os.link()
it is skipped completely.)
Trying to extract a hardlink and testing for its
existence afterwards is no option here, because it
doesn't necessarily need to be tarfile.py's fault if
this doesn't work. There are many different conditions
involved, especially the filesystem the test is made on.

My current solution is that the testcase tries to
create a link and if it gets an ENOENT (which means the
link's source file cannot be found) it fails. All other
EnvironmentErrors are ignored.
Interestingly this testcase even works on a FAT32
filesystem (on my Linux box) - if the link's source
cannot be found there is an ENOENT (and the test fails
as it should), and if it can be found there is an EPERM
which is ignored.

IMO all this is a bit too much black magic and maybe
the testcase introduces more problems than it actually
solves, so feel free to throw it away.

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

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



More information about the Patches mailing list