Title: tarfile tarinfo.extract*() broken with symlinks
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: lars.gustaebel Nosy List: Fabio.Erculiani, lars.gustaebel, python-dev
Priority: normal Keywords:

Created on 2011-09-07 10:04 by Fabio.Erculiani, last changed 2012-01-05 18:07 by lars.gustaebel. This issue is now closed.

Messages (3)
msg143667 - (view) Author: Fabio Erculiani (Fabio.Erculiani) Date: 2011-09-07 10:04
TarFile.makelink() is plain broken.
Test file:

_extract_member calls makelink which does os.symlink() and then falls to the else branch and calls back _extract_member(), which calls makelink() which calls os.symlink() and causes errno 17.

ERROR: test_db_insert_compare_match_mime (__main__.EntropyRepositoryTest)
Traceback (most recent call last):
  File "", line 490, in test_db_insert_compare_match_mime
    data = self.Spm.extract_package_metadata(test_pkg)
  File "../entropy/spm/plugins/interfaces/portage_plugin/", line 1038, in extract_package_metadata
    extract_path = pkg_dir, catch_empty = False)
  File "../entropy/", line 2088, in uncompress_tarball
    tar.extract(tarinfo, encoded_path)
  File "/usr/lib64/python3.2/", line 2174, in extract
  File "/usr/lib64/python3.2/", line 2258, in _extract_member
    self.makelink(tarinfo, targetpath)
  File "/usr/lib64/python3.2/", line 2358, in makelink
  File "/usr/lib64/python3.2/", line 2258, in _extract_member
    self.makelink(tarinfo, targetpath)
  File "/usr/lib64/python3.2/", line 2341, in makelink
    os.symlink(tarinfo.linkname, targetpath)
OSError: [Errno 17] File exists
msg150677 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-01-05 17:58
New changeset 573fc99873bd by Lars Gustäbel in branch '3.2':
Issue #12926: Fix a bug in tarfile's link extraction.

New changeset 5936c2005ab7 by Lars Gustäbel in branch 'default':
Merge from 3.2: Issue #12926: Fix a bug in tarfile's link extraction.
msg150678 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2012-01-05 18:07
This should be fixed now, thanks.
Date User Action Args
2012-01-05 18:07:30lars.gustaebelsetstatus: open -> closed
versions: + Python 3.3
messages: + msg150678

resolution: fixed
stage: resolved
2012-01-05 17:58:59python-devsetnosy: + python-dev
messages: + msg150677
2012-01-05 16:47:31lars.gustaebellinkissue13702 dependencies
2011-09-10 07:31:42lars.gustaebelsetassignee: lars.gustaebel
2011-09-07 20:04:44ned.deilysetnosy: + lars.gustaebel
2011-09-07 10:04:10Fabio.Erculianicreate