Martin Panter added the comment:

I guess it depends on the particular tar file and where it gets truncated. Just 
now I tested with a tar file created from Python’s Tools directory:

$ tar c Tools/ > good.tar
$ ls -gG good.tar 
-rw-r--r-- 1 17397760 May 28 02:43 good.tar
$ head -c 130000 good.tar > cut.tar
$ tar -tf cut.tar
Tools/
[. . .]
Tools/hg/hgtouch.py
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
[Exit 2]

Using Python 2.7.9, I can reproduce Thomas’s behaviour. It extracts the files 
with no error indication, and actually truncated the last extracted file to 
2512 bytes. Adding errorlevel=1 or errorlevel=2 did not make a difference.

Then I tried Python 3.3, 3.4 and 3.6 in various forms. They all seem to raise 
OSError, even with no errorlevel specified, and create the last file with zero 
bytes. So in this case I think it is a Python 2 bug (which I’m personally not 
so motivated to fix).

Ethan: how did you create and truncate your tar file? It almost sounds like it 
is intact, or maybe didn’t get truncated enough to completely wipe out the EOF 
block.

----------
type: enhancement -> behavior
versions: +Python 2.7

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

Reply via email to