New submission from George Notaras: Assume the following situation: - a healthy and uncompressed tar file: a.tar - the metadata of the 1st and second files within the archive start at positions 0 and 756 (realistic example values)
I partially damage 200 bytes of metadata (byte range 0-500) of the first archived file: f = open("a.tar", "rb+") f.seek(100) f.write("0"*200) Now, I seek to the start of the 2nd archived file's metadata: f.seek(756) And I try to open the tar archive using tarfile.open() passing the previous fileobject to it. import tarfile f_tar = tarfile.open(fileobj=f) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "tarfile.py", line 1143, in open raise ReadError("file could not be opened successfully") tarfile.ReadError: file could not be opened successfully Wouldn't the expected behaviour be to successfully open the tar archive at offset 756? It seems that tarfile.open(fileobj=f) seeks to position 0 of the fileobject f, fails to read the 1st archived file's metadata and throws an exception. ---------- components: Extension Modules messages: 58026 nosy: GeorgeNotaras severity: normal status: open title: tarfile.open(fileobj=f) and bad metadata of the first file within the archive type: behavior versions: Python 2.5 __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1531> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com