Michael B. Trausch asked:
When piping a compressed archive to tar, it does not automatically detect and subsequently take appropriate decompression action. ... However, if the archive is stored on disk and specified on the command-line, it works without this error message.
FYI, both Gunnar Ritter's Heirloom Tar <http://heirloom.sourceforge.net/tools.html> and my own bsdtar <http://people.freebsd.org/~kientzle/libarchive/> handle this as you would expect. (Last I checked, star did not, although that may have changed.) Eric Blake responded:
... when piping data in, the data is not seekable ... It is technically possible to create a filter thread or process, ... create a new output pipe, replay the first few bytes ... then read the remainder ... and play it out to the child process...
Libarchive (the archiving library that bsdtar is built on) handles this transparently without creating an extra thread or process, although the general principle is still essentially the same. (For gzip/bzip2, of course, libarchive uses zlib/bzlib directly, but Joerg Sonnenberger recently contributed some code to interact with an external program without creating an extra filter process.) I'm not sure how Heirloom Tar implements this, but I suspect it uses the multi-process approach, exactly as outlined by Eric Blake. It would be tricky, I expect, to adapt the code from libarchive into GNU tar, though you're welcome to try. Cheers, Tim Kientzle
