Bug 201506 - bsdtar fails on zfs compressed and/or sparse files
Summary: bsdtar fails on zfs compressed and/or sparse files
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
: 201498 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-12 20:38 UTC by Marcus Reid
Modified: 2015-07-30 19:24 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Reid 2015-07-12 20:38:28 UTC
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
Comment 1 Bryan Drewery freebsd_committer 2015-07-15 18:56:09 UTC
I can commit this on this weekend unless someone else does it first.
Comment 2 Bryan Drewery freebsd_committer 2015-07-15 18:56:59 UTC
Upstream commit https://github.com/libarchive/libarchive/commit/bf4f6ec64e
Comment 3 Shuichi KITAGUCHI 2015-07-18 11:13:37 UTC
*** Bug 201498 has been marked as a duplicate of this bug. ***
Comment 4 Bryan Drewery freebsd_committer 2015-07-28 17:33:14 UTC
Working on this now.
Comment 5 commit-hook freebsd_committer 2015-07-28 18:42:12 UTC
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
Comment 6 Marcus Reid 2015-07-28 22:16:26 UTC
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!
Comment 7 commit-hook freebsd_committer 2015-07-30 17:04:59 UTC
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
Comment 8 commit-hook freebsd_committer 2015-07-30 18:01:07 UTC
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