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

Antoine Pitrou solipsis at pitrou.net
Thu Apr 28 17:44:51 CEST 2011


On Thu, 28 Apr 2011 17:40:05 +0200
Nadeem Vawda <nadeem.vawda at gmail.com> wrote:
> 
> The deletion case could be handled like this:
> 
>              if tarinfo.issym():
> +                try:
> +                    os.unlink(targetpath)
> +                except OSError as e:
> +                    if e.errno != errno.ENOENT:
> +                        raise
>                  os.symlink(tarinfo.linkname, targetpath)

Someone can still create "targetpath" between the calls to unlink() and
symlink() though.

Regards

Antoine.




More information about the Python-checkins mailing list