Chris AtLee <ch...@atlee.ca> added the comment:

It's caused by the combination of the symlink existing, and having the tarfile 
opened in r| mode.

If I run the attached test file in a fresh directory, I get the following 
exception:

raceback (most recent call last):
  File "/home/catlee/.pyenv/versions/3.8.2/lib/python3.8/tarfile.py", line 
2227, in makelink
    os.symlink(tarinfo.linkname, targetpath)
FileExistsError: [Errno 17] File exists: 'message.txt' -> './symlink.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "../test.py", line 12, in <module>
    tf.extractall()
  File "/home/catlee/.pyenv/versions/3.8.2/lib/python3.8/tarfile.py", line 
2024, in extractall
    self.extract(tarinfo, path, set_attrs=not tarinfo.isdir(),
  File "/home/catlee/.pyenv/versions/3.8.2/lib/python3.8/tarfile.py", line 
2065, in extract
    self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
  File "/home/catlee/.pyenv/versions/3.8.2/lib/python3.8/tarfile.py", line 
2145, in _extract_member
    self.makelink(tarinfo, targetpath)
  File "/home/catlee/.pyenv/versions/3.8.2/lib/python3.8/tarfile.py", line 
2237, in makelink
    self._extract_member(self._find_link_target(tarinfo),
  File "/home/catlee/.pyenv/versions/3.8.2/lib/python3.8/tarfile.py", line 
2137, in _extract_member
    self.makefile(tarinfo, targetpath)
  File "/home/catlee/.pyenv/versions/3.8.2/lib/python3.8/tarfile.py", line 
2176, in makefile
    source.seek(tarinfo.offset_data)
  File "/home/catlee/.pyenv/versions/3.8.2/lib/python3.8/tarfile.py", line 513, 
in seek
    raise StreamError("seeking backwards is not allowed")
tarfile.StreamError: seeking backwards is not allowed

----------
Added file: https://bugs.python.org/file49168/test.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue12800>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to