[Python-Dev] [Python-checkins] cpython (2.7): Fix closes issue10761: tarfile.extractall failure when symlinked files are (original) (raw)

Éric Araujo merwok at netwok.org
Thu Apr 28 16:20:06 CEST 2011


Hi,

I’m still educating myself about concurrency and race conditions, so I hope my naïve question won’t be just a waste of time. Here it is:

http://hg.python.org/cpython/rev/0c8bc3a0130a user: Senthil Kumaran <orsenthil at gmail.com> summary: Fix closes issue10761: tarfile.extractall failure when symlinked files are present.

diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2239,6 +2239,8 @@ if hasattr(os, "symlink") and hasattr(os, "link"): # For systems that support symbolic and hard links. if tarinfo.issym(): + if os.path.exists(targetpath): + os.unlink(targetpath)

Is there a race condition here?

Thanks Regards



More information about the Python-Dev mailing list