[issue44899] tarfile: add support for creating an archive of potentially changing files

Marko Tuononen report at bugs.python.org
Fri Oct 29 09:20:50 EDT 2021


Marko Tuononen <marko.tuononen at gmail.com> added the comment:

Please find attached an example how to reproduce the problem in question.

$ python3 -m unittest tarfile_ut.py
E
======================================================================
ERROR: test_stat (tarfile_ut.TestClass)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.6/unittest/mock.py", line 1183, in patched
    return func(*args, **keywargs)
  File "/var/work/mtuonone/tarfile_ut.py", line 39, in test_stat
    tar.add(TEMP_FILENAME)
  File "/usr/lib64/python3.6/tarfile.py", line 1952, in add
    self.addfile(tarinfo, f)
  File "/usr/lib64/python3.6/tarfile.py", line 1980, in addfile
    copyfileobj(fileobj, self.fileobj, tarinfo.size, bufsize=bufsize)
  File "/usr/lib64/python3.6/tarfile.py", line 257, in copyfileobj
    raise exception("unexpected end of data")
OSError: unexpected end of data

----------------------------------------------------------------------
Ran 1 test in 0.006s

FAILED (errors=1)
$

----------
Added file: https://bugs.python.org/file50411/tarfile_ut.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44899>
_______________________________________


More information about the Python-bugs-list mailing list