Test case 1: sparse file # truncate -s10g foo # echo "bar" >> foo # tar cf - foo | tar tf - foo tar: Truncated input file (needed 10737418240 bytes, only 8192 available) tar: Error exit delayed from previous errors. Test case 2: zfs compressed file (this is run on a zfs filesystem with lz4 compression turned on) # dd if=/dev/zero of=derp bs=1m count=10k # echo foo >> derp # tar cf - derp | tar tf - derp tar: Truncated input file (needed 10737418240 bytes, only 8192 available) tar: Error exit delayed from previous errors. In a real-world scenario, I encountered this bug when restoring a large VM disk image from a tape. The source image was on a compressed zfs filesystem. These issues may have been fixed upstream. See: https://github.com/libarchive/libarchive/issues/464
I can commit this on this weekend unless someone else does it first.
Upstream commit https://github.com/libarchive/libarchive/commit/bf4f6ec64e
*** Bug 201498 has been marked as a duplicate of this bug. ***
Working on this now.
A commit references this bug: Author: bdrewery Date: Tue Jul 28 18:41:30 UTC 2015 New revision: 285972 URL: https://svnweb.freebsd.org/changeset/base/285972 Log: MFV r285970: Apply upstream changeset bf4f6ec64e: Fix issue 356: properly skip a sparse file entry in a tar file. PR: 201506 MFC after: 3 days Relnotes: yes Changes: _U head/contrib/libarchive/ _U head/contrib/libarchive/libarchive/ head/contrib/libarchive/libarchive/archive_read_support_format_tar.c head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu head/lib/libarchive/test/Makefile
Fixed both of the test cases noted in the report, as well as a virtual disk image that was also triggering the bug. Thank you!
A commit references this bug: Author: bdrewery Date: Thu Jul 30 17:04:17 UTC 2015 New revision: 286082 URL: https://svnweb.freebsd.org/changeset/base/286082 Log: MFC r285972: MFV r285970: Apply upstream changeset bf4f6ec64e: Fix issue 356: properly skip a sparse file entry in a tar file. PR: 201506 Relnotes: yes Changes: _U stable/10/ stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu stable/10/lib/libarchive/test/Makefile
A commit references this bug: Author: bdrewery Date: Thu Jul 30 18:00:39 UTC 2015 New revision: 286084 URL: https://svnweb.freebsd.org/changeset/base/286084 Log: MFS r286082: MFC r285972: MFV r285970: Apply upstream changeset bf4f6ec64e: Fix issue 356: properly skip a sparse file entry in a tar file. PR: 201506 Relnotes: yes Approved by: re (gjb) Changes: _U releng/10.2/ releng/10.2/contrib/libarchive/libarchive/archive_read_support_format_tar.c releng/10.2/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c releng/10.2/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu releng/10.2/lib/libarchive/test/Makefile