[issue21044] tarfile does not handle file .name being an int

2017-06-01 Thread Antoine Pietri

Changes by Antoine Pietri :


--
stage: test needed -> resolved
status: open -> closed

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-09-27 Thread R. David Murray

Changes by R. David Murray :


--
stage: commit review -> test needed
versions: +Python 2.7 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 825137d0d4ca by Serhiy Storchaka in branch '3.4':
Correct issue #21044 patch author.
http://hg.python.org/cpython/rev/825137d0d4ca

New changeset 4fe27263f9d4 by Serhiy Storchaka in branch 'default':
Correct issue #21044 patch author.
http://hg.python.org/cpython/rev/4fe27263f9d4

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Zachary for pointing to buildbot failure.

> Also, Serhiy, I think you may have got me mixed up with someone else.

Indeed, I either missed you with Antoine Pietri or missed this issue with 
issue19524. In any case thanks you for your activity on the tracker. And thanks 
Antoine Pietri for his contribution on this issue.

> Still, it would be interesting to investigate why this breaks 2.7 though.

Left open until will investigated this. Will open a new issue if there is a bug 
here.

--
resolution:  -> remind

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-22 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 51699f5f5430 by Serhiy Storchaka in branch '2.7':
Backout 308f3c1e36d3.  This change (issue21044) does not need to be merged on
http://hg.python.org/cpython/rev/51699f5f5430

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-17 Thread Antoine Pietri

Antoine Pietri added the comment:

This change does not need to be merged on 2.7 anyway, as the os.fdopen sets the 
name attribute to '' and not to the fd, this check is not required 
prior to python 3.

Still, it would be interesting to investigate why this breaks 2.7 though.

--
versions:  -Python 2.7

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-17 Thread Zachary Ware

Zachary Ware added the comment:

This change appears to have broken 2.7 on Windows:

http://buildbot.python.org/all/builders/x86%20Windows7%202.7/builds/2707/steps/test/logs/stdio

--
nosy: +zach.ware
resolution: fixed -> 
stage: resolved -> commit review
status: closed -> open

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-17 Thread Antoine Pietri

Antoine Pietri added the comment:

> Also, Serhiy, I think you may have got me mixed up with someone else. I don’t 
> think I did any patches here, so I probably shouldn’t be credited for them :)

Yeah, but I don't mind if I'm not in the ACKS file for a one-line patch though 
:P

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-17 Thread Martin Panter

Martin Panter added the comment:

Opened Issue 21996 for the “gettarinfo” method.

Also, Serhiy, I think you may have got me mixed up with someone else. I don’t 
think I did any patches here, so I probably shouldn’t be credited for them :)

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed with rewritten tests. Thank you for your contribution Martin.

> 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?

Yes, this looks as a separate bug.

--
resolution:  -> fixed
stage: test needed -> resolved
status: open -> closed
versions: +Python 2.7

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 308f3c1e36d3 by Serhiy Storchaka in branch '2.7':
Issue 21044: tarfile.open() now handles fileobj with an integer 'name'
http://hg.python.org/cpython/rev/308f3c1e36d3

New changeset d6b71971b228 by Serhiy Storchaka in branch '3.4':
Issue 21044: tarfile.open() now handles fileobj with an integer 'name'
http://hg.python.org/cpython/rev/d6b71971b228

New changeset 4c2f3240ad65 by Serhiy Storchaka in branch 'default':
Issue 21044: tarfile.open() now handles fileobj with an integer 'name'
http://hg.python.org/cpython/rev/4c2f3240ad65

--
nosy: +python-dev

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-07-10 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-04-21 Thread Martin Panter

Martin Panter added the comment:

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 "", line 3, in 
  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.

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-04-05 Thread eryksun

eryksun added the comment:

> you can't overwrite a io.FileIO().name attribute

A FileIO instance uses a dict for 'name' (msg214670): 

>>> vars(sys.stdin.buffer.raw)
{'name': ''}

>>> f = tempfile.TemporaryFile()
>>> vars(f.raw)
{'name': 3}

The name is optional meta-information. If it gets deleted, the repr falls back 
on using the file descriptor:

>>> f.raw
<_io.FileIO name=3 mode='rb+'>

>>> del f.raw.name
>>> f.raw
<_io.FileIO fd=3 mode='rb+'>

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-04-05 Thread Ezio Melotti

Changes by Ezio Melotti :


Added file: http://bugs.python.org/file34740/test_tarfile_fdopen.diff

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-04-05 Thread Antoine Pietri

Antoine Pietri added the comment:

Well, that seems complicated: you can't overwrite a io.FileIO().name attribute, 
and doing so would be nonsensical for tarfile, which would try to perform IO 
operations on a random file descriptor... Also, I can't think of any case where 
a .name attribute could actually be bytes (I was just mirroring the code in 
msg214670).

Here's a patch that tries all combinations of encoding for writing, but I can't 
see a way to enforce manually the name attribute being an int, even for this 
test purposes.

--
Added file: http://bugs.python.org/file34739/test_tarfile_all_modes.diff

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage: patch review -> test needed

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Does tarfile work with bytes file names?

I think a test should explicitly test file objects with str, bytes and int name 
and file objects without name in all write modes ("w", "w:gz", "w|gz", etc).

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-30 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +lars.gustaebel

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-30 Thread Antoine Pietri

Antoine Pietri added the comment:

Ping. The patch is just one line and there's a test case, if someone could 
review that, it would be great!

(For the record I signed the contributor agreement a week ago and my profile 
still hasn't been updated).

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-24 Thread Antoine Pietri

Antoine Pietri added the comment:

Well, this behavior seems pretty inconsistent to me, it means that every 
library has to check if the name attribute  is actually a string (which would 
correspond to a path) or an int (that would mean a fd), and I think a "fd" 
attribute would seem more consistent.
But as I don't think we could change this behavior that easily (it means 
breaking retrocompatibility after all...), we must at least make tarlib deal 
with that.

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-24 Thread Antoine Pietri

Antoine Pietri added the comment:

Yes, the bug report was originally titled like this ("TemporaryFile should'nt 
have a name attribute") but apparently this is a common and expected behavior 
for FileIO subclasses.

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-24 Thread R. David Murray

R. David Murray added the comment:

See the documentation link in msg214670.  This isn't a characteristic of 
TemporaryFile, it's a characteristic of the Python IO system.  So you'd have to 
argue that the documented behavior of the io system is a bug.

--

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-24 Thread Éric Araujo

Éric Araujo added the comment:

Isn’t the bug here really that TemporaryFile has a name attribute that’s not a 
string?  I don’t see how an integer name makes sense within the IO system.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-24 Thread Antoine Pietri

Antoine Pietri added the comment:

Here's the test case as requested by berkerpeksag in the patch review.

--
Added file: http://bugs.python.org/file34605/test_tarfile_fobj_int.diff

___
Python tracker 

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



[issue21044] tarfile does not handle file .name being an int

2014-03-24 Thread R. David Murray

Changes by R. David Murray :


--
title: tarfile does not handle file __name__ being an int -> tarfile does not 
handle file .name being an int

___
Python tracker 

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