Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tarfile tarinfo.extract*() broken with symlinks #57135

Closed
FabioErculiani mannequin opened this issue Sep 7, 2011 · 3 comments
Closed

tarfile tarinfo.extract*() broken with symlinks #57135

FabioErculiani mannequin opened this issue Sep 7, 2011 · 3 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@FabioErculiani
Copy link
Mannequin

FabioErculiani mannequin commented Sep 7, 2011

BPO 12926
Nosy @gustaebel

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/gustaebel'
closed_at = <Date 2012-01-05.18:07:30.976>
created_at = <Date 2011-09-07.10:04:10.501>
labels = ['library', 'type-crash']
title = 'tarfile tarinfo.extract*() broken with symlinks'
updated_at = <Date 2012-01-05.18:07:30.974>
user = 'https://bugs.python.org/FabioErculiani'

bugs.python.org fields:

activity = <Date 2012-01-05.18:07:30.974>
actor = 'lars.gustaebel'
assignee = 'lars.gustaebel'
closed = True
closed_date = <Date 2012-01-05.18:07:30.976>
closer = 'lars.gustaebel'
components = ['Library (Lib)']
creation = <Date 2011-09-07.10:04:10.501>
creator = 'Fabio.Erculiani'
dependencies = []
files = []
hgrepos = []
issue_num = 12926
keywords = []
message_count = 3.0
messages = ['143667', '150677', '150678']
nosy_count = 3.0
nosy_names = ['lars.gustaebel', 'python-dev', 'Fabio.Erculiani']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue12926'
versions = ['Python 3.2', 'Python 3.3']

@FabioErculiani
Copy link
Mannequin Author

FabioErculiani mannequin commented Sep 7, 2011

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

@FabioErculiani FabioErculiani mannequin added stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump labels Sep 7, 2011
@gustaebel gustaebel mannequin self-assigned this Sep 10, 2011
@python-dev
Copy link
Mannequin

python-dev mannequin commented Jan 5, 2012

New changeset 573fc99873bd by Lars Gustäbel in branch '3.2':
Issue bpo-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 bpo-12926: Fix a bug in tarfile's link extraction.
http://hg.python.org/cpython/rev/5936c2005ab7

@gustaebel
Copy link
Mannequin

gustaebel mannequin commented Jan 5, 2012

This should be fixed now, thanks.

@gustaebel gustaebel mannequin closed this as completed Jan 5, 2012
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

0 participants