Bug 268562 - bsdtar --fast-read not working when reading archive from stdin
Summary: bsdtar --fast-read not working when reading archive from stdin
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-25 22:32 UTC by rudi
Modified: 2022-12-28 03:38 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rudi 2022-12-25 22:32:03 UTC
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.
Comment 1 Ed Maste freebsd_committer freebsd_triage 2022-12-28 03:38:01 UTC
I would recommend submitting an issue in libarchive's tracker, at https://github.com/libarchive/libarchive