Bug 7706 - tar xz extract
Summary: tar xz extract
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.22.x
Hardware: Other Linux
: P5 blocker
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-10 12:11 UTC by Jiri Prchal
Modified: 2014-12-12 12:35 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
xz archive (2.50 KB, application/x-xz)
2014-12-10 12:54 UTC, Jiri Prchal
Details
archived file (576 bytes, text/plain)
2014-12-10 12:55 UTC, Jiri Prchal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prchal 2014-12-10 12:11:58 UTC
Hi,
when I compress (xz) folder with just one small file

/mnt/card #tar -cJv -f /akpkg.tar.xz akpkg/*
akpkg/sys.conf

and then try to decompress, I get this error

/mnt/card # tar -t -f /akpkg.tar.xz
tar: no gzip/bzip2/xz magic
/mnt/card # tar -tJ -f /akpkg.tar.xz
tar: corrupted data
tar: short read

With gzip or pure tar it works fine.
Compressed on PC (tar (GNU tar) 1.27.1)
and decompressed on busybox works too.

/mnt/card # busybox
BusyBox v1.22.1 (2014-04-14 14:39:49 CEST) multi-call binary.
/mnt/card # uname -a
Linux vyroba 3.17.4_cpm9g25 #6 PREEMPT Thu Nov 27 11:06:21 CET 2014 armv5tejl GNU/Linux
Comment 1 Denys Vlasenko 2014-12-10 12:49:40 UTC
Please attach the file which you are trying to compress, and the resulting tar.xz.
Comment 2 Jiri Prchal 2014-12-10 12:54:58 UTC
Created attachment 5786 [details]
xz archive
Comment 3 Jiri Prchal 2014-12-10 12:55:35 UTC
Created attachment 5792 [details]
archived file
Comment 4 Denys Vlasenko 2014-12-11 13:10:32 UTC
(In reply to comment #2)
> Created attachment 5786 [details]
> xz archive

The attached file is not a compressed file. It is an uncompressed tar file. despite its .xz extension
Comment 5 Denys Vlasenko 2014-12-11 14:35:00 UTC
The bug is that creation op was only handling gzip/bzip2. Fixed in git now. Thanks!
Comment 6 Jiri Prchal 2014-12-12 09:17:26 UTC
(In reply to comment #5)
> The bug is that creation op was only handling gzip/bzip2. Fixed in git now.
> Thanks!

This patch not work, file is zero size:

/mnt/card # tar -cJv -f /akpkg.tar.xz akpkg
akpkg/
akpkg/sys.conf
BusyBox v1.23.0.git (2014-12-12 08:37:33 CET) multi-call binary.

Usage: xz -d [-cf] [FILE]...

Decompress FILE (or stdin)

        -d      Decompress
        -c      Write to stdout
        -f      Force

/mnt/card # ls -l /
total 0
-rw-r--r--    1 root     root             0 Dec 12 09:13 akpkg.tar.xz
Comment 7 Denys Vlasenko 2014-12-12 11:41:37 UTC
You need to have a xz compressor installed for that to work.
Busybox's "xz" applet only has a decompressor: it will refuse to work without -d option.
Comment 8 Jiri Prchal 2014-12-12 12:35:30 UTC
(In reply to comment #7)
> You need to have a xz compressor installed for that to work.
> Busybox's "xz" applet only has a decompressor: it will refuse to work without
> -d option.

Now it works.
Thanks