On Sunday 06 February 2011 14:22, Daniel Baluta wrote:
> Hello,
> 
> I'm facing a strange problem when trying to extract a  .tgz file
> using busybox tar.
> 
> I have tested it with the latest git version, but it also reproduces
> with older busybox versions.
> 
> Busybox is compiled and used as described in Quick Start section
> from INSTALL file.
> 
> How to reproduce:
> 
> # create a 1M zero filled file
> $ dd count=1 bs=1M if=/dev/zero of=F0
> # create a tgz archive containing this file
> $ PATH= ./busybox tar -czvf F0.tgz F0
> # try to extract the file
> $ PATH= ./busybox tar -xzvf F0.tgz
> $ tar: invalid tar header checksum
> 
> Analyze:
> 
> The problem seems to be in libarchive/get_header_tar.c file,
> inside get_header_tar function.
> 
> Although, F0.tgz is a compressed tar.gz file it seems that
> get_header_tar_function tries to interpret the first
> 512 bytes of F0.tgz as a tar header.
> 
> In libarchive/get_header_tar.c:191:
> 
>  /* Check header has valid magic, "ustar" is for the proper tar,
>         * five NULs are for the old tar format  */
>        if (strncmp(tar.magic, "ustar", 5) != 0
>         && (!ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY
>             || memcmp(tar.magic, "\0\0\0\0", 5) != 0)
> 
> TAR_OLDGNU_COMPATIBILITY is turned on.
> 
> My question is why, isn't F0.tgz first decompressed to F0.tar, and
> after that extracted to F0?

There was a bug where archive autodetection was switching off -z.

I fixed it in git and added the fix to 1.18.3 patch pile.

Thanks!

-- 
vda


_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to