[Bug 268562] bsdtar --fast-read not working when reading archive from stdin

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 25 Dec 2022 22:32:03 UTC

            Bug ID: 268562
           Summary: bsdtar --fast-read not working when reading archive
                    from stdin
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: rudi@mip.xs4all.nl

Steps to reproduce:
A (large) TAR archive has been written to a raw disk /dev/da4. The disk (1TB)
is much larger than the archive (160GB).
Restoring a single file may take a long time, as tar reads all the way to the
end of the archive.
This can be solved with the -q option:
$ tar -xzOqf /dev/da4 myfile | md5sum
Result is the same, only much faster. The checksum is correct.
So far so good, but when tar is in a pipeline, it is slow again:
$ dd if=/dev/da4 bs=64k | tar -xzOqf - myfile | md5sum

Actual result:
It appears the -q option does not work when archive is stdin (-f-)
This looks like a bug of the (bsd)tar program.

Expected result:
I expected that the tar program would exit and close its input and output
after retrieval of 'myfile'. This would break the pipe to dd, and it would stop
as well.
Anyway, if dd is killed manually after the md5sum cpu usage has fallen to 0%,
the correct result is shown. It would be nice if killing is not needed.

You are receiving this mail because:
You are the assignee for the bug.