[BusyBox] tar stdin problems

Glenn McGrath bug1 at optushome.com.au
Tue Nov 12 07:50:05 UTC 2002


On Tue, 12 Nov 2002 14:09:12 +0200
Michael Sternberg <michaels at boscom.com> wrote:

> 
> Last CVS version of busybox (2002.11.12-10:51+0000)
> 
> ~> tar zxvf test.tar.gz
> first.file
> second.file
> third.file
> tar: Short read
> 
> ~> gunzip -c test.tar.gz | tar xv
> first.file
> second.file
> third.file
> tar: Short read
> 
> ~> gunzip test.tar.gz && tar xvf test.tar
> ~> echo $?
> 0
> 

This is nasty, ive tweaked a few things here, but im stuck iwht the
following scenario

These works
../busybox cat saa7134-0.1.11.tar | ../busybox tar -xvf -
../busybox bzcat saa7134-0.1.11.tar.bz2 | ../busybox tar -xvf -
../busybox tar -jxvf saa7134-0.1.11.tar.bz2
../busybox zcat saa7134-0.1.11.tar.gz | ../busybox tar -tvf -

These doesnt
../busybox zcat saa7134-0.1.11.tar.gz | ../busybox tar -xvf -
../busybox tar -zxvf saa7134-0.1.11.tar.gz

All the pieces of code are working in the different tests, its not a
problem reading from stdin, or extracting files, or parsing the tar
headers.

The problem is isolated to reading file data from a .tar.gz, but it can
read the tar headers the files, and it can read the file data if there is
no compression or bzip2 compression.

Actually, if i set the buffer in libbb/archive_copy_file to 512 Bytes
(same is the header size) i dont get short reads, but if i set it 513
Bytes it doesnt.

So it looks to be a problem when reading more than 512 bytes across the
pipe the read_header_tar_gz uses (read_header_bzip2 doesnt use a pipe),
why would that be a problem ?

Its late im going to have sleep on it.



Glenn




More information about the busybox mailing list