Package: tar
Version: 1.27.1-2+b1
Severity: wishlist

Hi,

the following setup:

$ touch test
$ tar -cJf test.xz.dummy test
$ tar -cjf test.bz2.dummy test
$ tar -czf test.gz.dummy test

We add .dummy as a suffix to make sure that tar does not use the
filename extension to detect the compression algorithm.

The following work fine (notice that the compression algorithm is not
given explicitly):

$ tar -tf test.xz.dummy
$ tar -tf test.bz2.dummy
$ tar -tf test.gz.dummy

This means that somehow tar must be able to detect which compression
algorithm to choose using the file magic.

The following also works fine:

$ tar -tf /dev/stdin < test.xz.dummy
$ tar -tf /dev/stdin < test.bz2.dummy
$ tar -tf /dev/stdin < test.gz.dummy

But the following (surprisingly) does not work:

$ tar -tf - < test.xz.dummy
tar: Archive is compressed. Use -J option
tar: Error is not recoverable: exiting now
tar -tf - < test.bz2.dummy
tar: Archive is compressed. Use -j option
tar: Error is not recoverable: exiting now
tar -tf - < test.gz.dummy
tar: Archive is compressed. Use -z option
tar: Error is not recoverable: exiting now

But the actual nuisance (and the goal of this bugreport) is that the
following does not work:

$ cat test.xz.dummy | tar -tf -
tar: Archive is compressed. Use -J option
tar: Error is not recoverable: exiting now
$ cat test.bz2.dummy | tar -tf -
tar: Archive is compressed. Use -j option
tar: Error is not recoverable: exiting now
$ cat test.gz.dummy | tar -tf -
tar: Archive is compressed. Use -z option
tar: Error is not recoverable: exiting now

Maybe unrelated, but I get a different error if I use /dev/stdin:

$ cat test.xz.dummy | tar -tf /dev/stdin
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
$ cat test.bz2.dummy | tar -tf /dev/stdin

bzip2: Compressed file ends unexpectedly;
        perhaps it is corrupted?  *Possible* reason follows.
bzip2: Inappropriate ioctl for device
        Input file = (stdin), output file = (stdout)

It is possible that the compressed file(s) have become corrupted.
You can use the -tvv option to test integrity of such files.

You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.

tar: Child returned status 2
tar: Error is not recoverable: exiting now
$ cat test.gz.dummy | tar -tf /dev/stdin

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now


The goal of this wishlist bug, is to allow tar to automatically detect
the compression method even when the input is only coming from stdin.

This would be very useful in cases where the input tar file does not
exist but when tar is used as part of a pipe.

It would be nice if it could be avoided to create a temporary tar file
only to take advantage of the automatic selection of decompression
algorithm that tar can do if it is given a filename as an argument.

Thanks!

cheers, josch


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to