This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tarfile tarinfo.extract*() broken with symlinks
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3
process
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 2022-04-11 14:57 by admin. 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: http://git.sabayon.org/entropy.git/tree/libraries/tests/packages/amarok-2.2.2.90.tbz2

_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 "db.py", line 490, in test_db_insert_compare_match_mime
    data = self.Spm.extract_package_metadata(test_pkg)
  File "../entropy/spm/plugins/interfaces/portage_plugin/__init__.py", line 1038, in extract_package_metadata
    extract_path = pkg_dir, catch_empty = False)
  File "../entropy/tools.py", line 2088, in uncompress_tarball
    tar.extract(tarinfo, encoded_path)
  File "/usr/lib64/python3.2/tarfile.py", line 2174, in extract
    set_attrs=set_attrs)
  File "/usr/lib64/python3.2/tarfile.py", line 2258, in _extract_member
    self.makelink(tarinfo, targetpath)
  File "/usr/lib64/python3.2/tarfile.py", line 2358, in makelink
    targetpath)
  File "/usr/lib64/python3.2/tarfile.py", line 2258, in _extract_member
    self.makelink(tarinfo, targetpath)
  File "/usr/lib64/python3.2/tarfile.py", 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.
http://hg.python.org/cpython/rev/573fc99873bd

New changeset 5936c2005ab7 by Lars Gustäbel in branch 'default':
Merge from 3.2: Issue #12926: Fix a bug in tarfile's link extraction.
http://hg.python.org/cpython/rev/5936c2005ab7
msg150678 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2012-01-05 18:07
This should be fixed now, thanks.
History
Date User Action Args
2022-04-11 14:57:21adminsetgithub: 57135
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