bugGNU tar - Bugs: bug #63250, tar lzma autocompression produces...


bug #63250: tar lzma autocompression produces the error "This does not look like a tar archive"

Submitter:  None
Submitted:  Sat 22 Oct 2022 07:16:29 AM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  gray
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment (Rich Markup)

Sat 22 Oct 2022 09:14:11 AM UTC, comment #2: 

Thank you for the quick response! I tried to build the current HEAD to verify the fix with

./bootstrap && ./configure && make

but got the following error

> cc1: fatal error: ./parse-datetime.c: No such file or directory

There is `gnu/parse-datetime.y`, but no `gnu/parse-datetime.c` indeed. Any ideas?

Ilya <cppbest>
Sat 22 Oct 2022 08:23:14 AM UTC, comment #1: 

The "This does not look like a tar archive" is not an error, but a warning.  It is produced, in particular, when tar is unable to determine file format by signature and file size is less than tar block size.  When the signature recognition fails, tar tries to determine file format by its suffix.  In this case, it succeeded and extracted the files.

I have installed the following fix to recognized LZMA files produced by xz:


PS: The --auto-compress option is not needed when extracting.

Sergey Poznyakoff <gray>
Project Administrator
Sat 22 Oct 2022 07:16:29 AM UTC, original submission:  

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/

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`).

Also see https://unix.stackexchange.com/q/721903.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by cppbest (Posted a comment)
  • -email is unavailable- added by gray (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.





    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-02-11 gray Open/ClosedOpen Closed
    2022-10-22 gray StatusNone Fixed
        Assigned toNone gray

    Back to the top

    Powered by Savane 3.11