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.

Author vinay.sajip
Recipients ezio.melotti, vinay.sajip
Date 2013-02-07.16:43:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1360255401.83.0.937643629633.issue17153@psf.upfronthosting.co.za>
In-reply-to
Content
The attached file failing.tar.gz contains a path with UTF-8-encoded Unicode. This causes extractall() to fail, but only when the destination path is Unicode. That's because it leads to a implicit str->unicode conversion using ASCII.

Test script:

import shutil, tarfile, tempfile

tf = tarfile.open('failing.tar.gz', 'r:gz')
workdir = tempfile.mkdtemp()
try:
    # N.B. ensure dest path is Unicode to trigger the failure
    tf.extractall(unicode(workdir))
finally:
    shutil.rmtree(workdir)

Result:

$ python untar.py
Traceback (most recent call last):
  File "untar.py", line 8, in <module>
    tf.extractall(unicode(workdir))
  File "/usr/lib/python2.7/tarfile.py", line 2046, in extractall
    self.extract(tarinfo, path)
  File "/usr/lib/python2.7/tarfile.py", line 2083, in extract
    self._extract_member(tarinfo, os.path.join(path, tarinfo.name))
  File "/usr/lib/python2.7/posixpath.py", line 71, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 44: ordinal not in range(128)
History
Date User Action Args
2013-02-07 16:43:21vinay.sajipsetrecipients: + vinay.sajip, ezio.melotti
2013-02-07 16:43:21vinay.sajipsetmessageid: <1360255401.83.0.937643629633.issue17153@psf.upfronthosting.co.za>
2013-02-07 16:43:21vinay.sajiplinkissue17153 messages
2013-02-07 16:43:21vinay.sajipcreate