HomeSoftware Heritage

package.loader: add a test to reproduce EOFError error

This commit no longer exists in the repository. It may have been part of a branch which was deleted.


package.loader: add a test to reproduce EOFError error

This exception generally occurs on sources coming from
sourceforge. Here the exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/swh/loader/package/", line 291, in load
  self._load_revision(p_info, origin)
File "/usr/lib/python3/dist-packages/swh/loader/package/", line 368, in _load_revision
  uncompressed_path = self.uncompress(dl_artifacts, dest=tmpdir)
File "/usr/lib/python3/dist-packages/swh/loader/package/", line 211, in uncompress
  uncompress(a_path, dest=uncompressed_path)
File "/usr/lib/python3/dist-packages/swh/core/", line 72, in uncompress
  shutil.unpack_archive(tarpath, extract_dir=dest)
File "/usr/lib/python3.7/", line 999, in unpack_archive
  func(filename, extract_dir, **kwargs)
File "/usr/lib/python3.7/", line 934, in _unpack_tarfile
File "/usr/lib/python3.7/", line 2002, in extractall
File "/usr/lib/python3.7/", line 2044, in extract
File "/usr/lib/python3.7/", line 2114, in _extract_member
  self.makefile(tarinfo, targetpath)
File "/usr/lib/python3.7/", line 2163, in makefile
  copyfileobj(source, target, tarinfo.size, ReadError, bufsize)
File "/usr/lib/python3.7/", line 247, in copyfileobj
  buf =
File "/usr/lib/python3.7/", line 178, in read
File "/usr/lib/python3.7/", line 68, in readinto
  data =
File "/usr/lib/python3.7/", line 99, in read
  raise EOFError("Compressed file ended before the "
EOFError: Compressed file ended before the end-of-stream marker was reached

This error is reproduced (with a manually truncated archive file) and checked
by the test test_eoferror where we check a snapshot is still created.


lewoAuthored on Mar 20 2020, 11:10 AM
lewoPushed on Mar 23 2020, 3:43 PM
Differential Revision
D2859: package.loader: catch the EOFError exception in uncompress function
Build Status
Buildable 11288
Build 17064: test-and-buildJenkins

Commit No Longer Exists

This commit no longer exists in the repository.