Issue 12926: tarfile tarinfo.extract*() broken with symlinks (original) (raw)

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