Sample Header Ad - 728x90

tar lzma autocompression produces the error "This does not look like a tar archive"

3 votes
1 answer
440 views
The following script
mkdir test && cd test
mkdir files
touch files/{1,2,3}
tar --create --file "test.lzma" files/{1,2,3} --auto-compress
mkdir extracted_files
tar --extract --file "test.lzma" --directory extracted_files --auto-compress
produces the following error: > tar: This does not look like a tar archive but actually tar+compress and uncompress+untar do happen (files are in place). Why is this happening? Is it some kind of bug in tar? On my system:
xz --version
 xz (XZ Utils) 5.2.7
 liblzma 5.2.7
tar --version
 tar (GNU tar) 1.34
file test/test.lzma
 test/test.lzma: LZMA compressed data, streamed
ls test/extracted_files/
 files
You can also reproduce it in https://replit.com/languages/bash (with xz (XZ Utils) 5.2.2 and tar (GNU tar) 1.34). But not in https://www.onlinegdb.com/online_bash_shell (with xz (XZ Utils) 5.2.4 and tar (GNU tar) 1.30).
Asked by cppbest (193 rep)
Oct 21, 2022, 01:35 PM
Last activity: Oct 22, 2022, 01:15 PM