tar piped to curl: This does not look like a tar archive

0

curl -L http://download.transmissionbt.com/files/transmission-2.80.tar.xz -s -o - | tar -xf -

The error:

tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors

However when I do this, It can extract the archive:

curl -LO http://download.transmissionbt.com/files/transmission-2.80.tar.xz
tar xf transmission-2.80.tar.xz

Why did the pipe not work?

Jürgen Paul

Posted 2013-07-19T01:35:40.480

Reputation: 715

Answers

5

I think you need tar's -J option in your pipe. e.g. | tar -xJf -

The -J option tells tar to use xz compression.

I think that the reason why tar xf transmission-2.80.tar.xz works without -J is that the option is inferred by tar based on the file extension.

Dan D.

Posted 2013-07-19T01:35:40.480

Reputation: 5 138

2

The pipe did not work because a binary stream does not end with a recognized file extension. The binary stream in this particular case was compressed with LZMA. A tar archive is not the same as some LZMA compressed data. This is exactly what tar told you.

If you let it know what kind of compression (options J, j, z) a tar archive was created with, it will decompress first using that algorithm and recognize the decompressed data stream as a tar archive.

Ярослав Рахматуллин

Posted 2013-07-19T01:35:40.480

Reputation: 9 076

Yhank you for the thorough explanation sir. – Jürgen Paul – 2013-07-19T08:09:10.533