[issue21996] gettarinfo method does not handle files without text string names

2016-02-19 Thread Martin Panter

Changes by Martin Panter :


--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
versions: +Python 3.6 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21996] gettarinfo method does not handle files without text string names

2016-02-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 94a94deaf06a by Martin Panter in branch '3.5':
Issues #22468, #21996, #22208: Clarify gettarinfo() and TarInfo usage
https://hg.python.org/cpython/rev/94a94deaf06a

New changeset 9d5217aaea13 by Martin Panter in branch '2.7':
Issues #22468, #21996, #22208: Clarify gettarinfo() and TarInfo usage
https://hg.python.org/cpython/rev/9d5217aaea13

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21996] gettarinfo method does not handle files without text string names

2016-02-09 Thread Martin Panter

Changes by Martin Panter :


--
dependencies: +Tarfile using fstat on GZip file object

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21996] gettarinfo method does not handle files without text string names

2015-04-19 Thread Martin Panter

Martin Panter added the comment:

Over in Issue 22468, I posted a documentation patch which includes wording to 
address this bug.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21996
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21996] gettarinfo method does not handle files without text string names

2014-07-19 Thread R. David Murray

R. David Murray added the comment:

Agreed, the documentation should be modified to say (using os.fstat on its 
file descriptor, and its 'name' attribute if arcname is not specified).

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python, r.david.murray
stage:  - needs patch
versions: +Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21996
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21996] gettarinfo method does not handle files without text string names

2014-07-17 Thread Martin Panter

New submission from Martin Panter:

It looks like if you pass a “fileobj” argument to “gettarinfo”, it assumes it 
can use the “name” as a text string.

 import tarfile
 with tarfile.open(/dev/null, w) as tar, open(/bin/sh, rb) as file: 
 tar.gettarinfo(fileobj=file)
... 
TarInfo 'bin/sh' at 0x7f13cc937f20
 with tarfile.open(/dev/null, w) as tar, open(b/bin/sh, rb) as file: 
 tar.gettarinfo(fileobj=file)
... 
Traceback (most recent call last):
  File stdin, line 1, in module
  File /media/disk/home/proj/python/cpython/Lib/tarfile.py, line 1767, in 
gettarinfo
arcname = arcname.replace(os.sep, /)
TypeError: expected bytes, bytearray or buffer compatible object
 with tarfile.open(/dev/null, w) as tar, open(0, rb, closefd=False) as 
 file: tar.gettarinfo(fileobj=file)
... 
Traceback (most recent call last):
  File stdin, line 1, in module
  File /media/disk/home/proj/python/cpython/Lib/tarfile.py, line 1766, in 
gettarinfo
drv, arcname = os.path.splitdrive(arcname)
  File Lib/posixpath.py, line 133, in splitdrive
return p[:0], p
TypeError: 'int' object is not subscriptable

In my case, my code always sets the final TarInfo.name attribute later on, so 
the initial name does not matter. Perhaps at least the documentation should say 
that “fileobj.name” must be a real unencoded file name string unless “arcname” 
is also given. My workaround was to add a dummy arcname argument, a bit like 
this:

# Explicit dummy name to avoid using file name of bytes
tarinfo = self.tar.gettarinfo(fileobj=file, arcname=)
# . . .
tarinfo.name = {}/{}.format(self.pkgname, name)

--
components: Library (Lib)
messages: 223318
nosy: vadmium
priority: normal
severity: normal
status: open
title: gettarinfo method does not handle files without text string names
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21996
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21996] gettarinfo method does not handle files without text string names

2014-07-17 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +serhiy.storchaka
versions: +Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21996
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com