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 mxmlnkn
Recipients mxmlnkn
Date 2020-05-24.18:10:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590343844.38.0.257135087645.issue40757@roundup.psfhosted.org>
In-reply-to
Content
Normally, when opening an existing non-TAR file, e.g., a file with random data, an exception is raised:

tarfile.open( "foo.txt" )

    ---------------------------------------------------------------------------
    ReadError                                 Traceback (most recent call last)
    <ipython-input-53-aa60172c3e3b> in <module>()
    ----> 1 f = tarfile.open( "notes.txt", ignore_zeros = False )

    /usr/lib/python3.7/tarfile.py in open(cls, name, mode, fileobj, bufsize, **kwargs)
       1576                         fileobj.seek(saved_pos)
       1577                     continue
    -> 1578             raise ReadError("file could not be opened successfully")
       1579 
       1580         elif ":" in mode:

    ReadError: file could not be opened successfully

However, when specifying ignore_zeros = True, this check against invalid data seems to be turned off. Note that it is >invalid< data not >zero< data and therefore should still raise an exception!

tarfile.open( "foo.txt", ignore_zeros = True )

Iterating over that opened tarfile also works without exception however nothing will be iterated over, i.e., it behaves like an empty TAR instead of like an invalid TAR.
History
Date User Action Args
2020-05-24 18:10:44mxmlnknsetrecipients: + mxmlnkn
2020-05-24 18:10:44mxmlnknsetmessageid: <1590343844.38.0.257135087645.issue40757@roundup.psfhosted.org>
2020-05-24 18:10:44mxmlnknlinkissue40757 messages
2020-05-24 18:10:44mxmlnkncreate