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 martin.panter
Recipients antoine.pietri, eric.araujo, eryksun, lars.gustaebel, martin.panter, r.david.murray, serhiy.storchaka
Date 2014-04-22.04:34:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398141271.58.0.566913183651.issue21044@psf.upfronthosting.co.za>
In-reply-to
Content
I ran into a related issue with the gettarinfo() method. Would that fall under the scope of this bug, or should I raise a separate one?

>>> with tarfile.open("/dev/null", "w") as tar:
...     with open(b"/bin/sh", "rb") as file:
...         tar.gettarinfo(fileobj=file)
... 
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "/usr/lib/python3.4/tarfile.py", line 1768, in gettarinfo
    arcname = arcname.replace(os.sep, "/")
TypeError: expected bytes, bytearray or buffer compatible object

I realise that making TarInfo object with a byte string or integer as a file name is not a good idea. Perhaps the documentation should explicitly say that “fileobj.name” must be a real unencoded file name string unless “arcname” is also given. In my particular case I added arcname="", because my code generates the proper file name later on.
History
Date User Action Args
2014-04-22 04:34:31martin.pantersetrecipients: + martin.panter, lars.gustaebel, eric.araujo, r.david.murray, serhiy.storchaka, eryksun, antoine.pietri
2014-04-22 04:34:31martin.pantersetmessageid: <1398141271.58.0.566913183651.issue21044@psf.upfronthosting.co.za>
2014-04-22 04:34:31martin.panterlinkissue21044 messages
2014-04-22 04:34:31martin.pantercreate