[BusyBox 0000347]: tar: Decompression failed returns exit status 0 even error happened

bugs at busybox.net bugs at busybox.net
Fri Dec 23 18:23:21 UTC 2005


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=347 
====================================================================== 
Reported By:                robang74
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   347
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             07-21-2005 14:57 PDT
Last Modified:              12-23-2005 10:23 PST
====================================================================== 
Summary:                    tar: Decompression failed returns exit status 0 even
error happened
Description: 
BEFORE (original 1.00 on the embbedded device):

root at embeslax:~# cd /tmp
root at embeslax:/tmp# dd if=/dev/zero of=pippo.tar.bz2 bs=1k count=1
1+0 records in
1+0 records out
root at embeslax:/tmp# tar xjf pippo.tar.bz2; echo $?
tar: Decompression failed
0

AFTER (patched on my workstation): 

bash-2.05b# dd if=/dev/zero of=pippo.tar.bz2 bs=1k count=1
0+0 records in
0+0 records out
bash-2.05b# _install/bin/tar xjf pippo.tar.bz2; echo $?
tar: Decompression failed
255

====================================================================== 

---------------------------------------------------------------------- 
 robang74 - 12-22-05 08:20  
---------------------------------------------------------------------- 
This patch affects rpm too.

Version n.4 fix the issue for every applets using open_transformer
function.

 

---------------------------------------------------------------------- 
 robang74 - 12-22-05 08:16  
---------------------------------------------------------------------- 
PLEASE IGNORE PATCH BEFORE busybox-1.01_raf_3.diff
because they don't work propely or don't work at all.
:-(


Create a broken tar.gz (.bz2/.Z show the same)

tar cvzf /tmp/test.tar.gz /bin/bash 
dd if=/tmp/test.tar.gz of=/tmp/test.tar.gz0 bs=1k count=10
dd if=/dev/zero >>/tmp/test.tar.gz0 bs=1k count=10

BEFORE patch

./busybox tar tvzf /tmp/test.tar.gz0; echo $?
tar: unexpected end of file
0

AFTER patch

./busybox tar tvzf /tmp/test.tar.gz0; echo $?
tar: unexpected end of file
tar: null size tar archive
1

 

---------------------------------------------------------------------- 
 robang74 - 12-22-05 08:13  
---------------------------------------------------------------------- 
PATCH busybox-1.01_raf_4.diff

 - do not include changes at Makefile
 - open_transformer learn how to manage child's exit status [1]
 - supposed that open_transformer is better in preventing zombies
(useless)
 - minor changes

AFTER patch:

./busybox tar tvzf /tmp/test.tar.gz0; echo $?
tar: unexpected end of file
tar: child exit with error code 1
1


 Under Mandriva 2006 linuxbox compiling, running and comparing bb-original
and bb-patched show no any differences in file size and memory usage:

[roberto at wsraf busybox-1.01]$ ls -al busybox
-rwxr-xr-x  1 roberto users 237032 dic 22 15:56 busybox*
[roberto at wsraf busybox-1.01]$ md5sum busybox
c47e7323c2a269856a6f5b46dbcf360f  busybox

[roberto at wsraf busybox-1.01_raf]$ ls -al busybox
-rwxr-xr-x  1 roberto users 237032 dic 22 15:54 busybox*
[roberto at wsraf busybox-1.01_raf]$ md5sum busybox
7043c59660c1b9748278c57e27647137  busybox 


 About memory usage no differences appear using this method:

    ./busybox tar xz - >/dev/null &
    ps wl $!

 or adding a system("ps wl"); in the parent proccess:

[roberto at wsraf busybox-1.01_raf]$ ./busybox tar tvzf /tmp/test.tar.gz
F   UID   PID  PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME
COMMAND
0  1309  7150 28474  17   0   1796   444 wait   S+   pts/3      0:00 tar
tvzf /tmp/test.tar.gz
1  1309  7151  7150  17   0   1796   520 pipe_w S+   pts/3      0:00 tar
tvzf /tmp/test.tar.gz

[roberto at wsraf busybox-1.01]$ ./busybox tar tvzf /tmp/test.tar.gz
F   UID   PID  PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME
COMMAND
0  1309  7165 28474  16   0   1796   444 wait   S+   pts/3      0:00 tar
tvzf /tmp/test.tar.gz
1  1309  7166  7165  16   0   1796   520 pipe_w S+   pts/3      0:00 tar
tvzf /tmp/test.tar.gz

 may be better memory usage benchmark than ps could reveal differences.


 [1] without this feature every applets like rpm which call open_transform
has to be instructed to find zero lenght file/data and exit with error in
order to return a coherent exit status in case of child failure. Everyone
whom (will) write an applet which use open_transform has to be
acknowledged of this. 
 This patch introducing asyncronous child managment resolve this issue
defintely.

 

---------------------------------------------------------------------- 
 robang74 - 12-23-05 10:23  
---------------------------------------------------------------------- 
Probably this has to be submitted as another bug, anyway bunzip2 set
permission in wrong way because it does not make stat on the src file.

/tmp # dd if=/bin/busybox >testfile bs=1k count=100; ls -al testfile
100+0 records in
100+0 records out
-rw-r--r--    1 0        0          102400 Dec 23 18:02 testfile
/tmp # chmod go-r testfile*; ls -al testfile*
-rw-------    1 0        0          102400 Dec 23 18:02 testfile
/tmp # bzip2 testfile; ls -al testfile*
-rw-------    1 0        0           59700 Dec 23 18:02 testfile.bz2
/tmp # bunzip2 testfile.bz2; ls -al testfile*
-rwxr-xr-x    1 0        0          102400 Dec 23 18:03 testfile
/tmp # umask
0022

patch n.6 fix this behaviur too:

/tmp # bzip2 testfile
/tmp # bunzip2 testfile.bz2
/tmp # ls -al testfile*
-rw-r--r--    1 0        0          102400 Dec 23 18:21 testfile 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-21-05 14:57  robang74       New Issue                                    
07-21-05 14:57  robang74       Status                   new => assigned     
07-21-05 14:57  robang74       Assigned To               => BusyBox         
07-21-05 14:57  robang74       File Added: busybox-1.00_raf.diff                
   
07-21-05 15:00  robang74       Note Added: 0000337                          
12-19-05 06:50  robang74       Issue Monitored: robang74                    
12-19-05 07:14  robang74       Note Added: 0000801                          
12-19-05 07:15  robang74       File Added: busybox-1.01_raf.diff                
   
12-19-05 07:16  robang74       Note Added: 0000802                          
12-21-05 12:51  robang74       Note Added: 0000805                          
12-21-05 12:51  robang74       Note Deleted: 0000802                        
12-21-05 12:52  robang74       Note Deleted: 0000801                        
12-21-05 12:52  robang74       File Added: busybox-1.01_raf_3.diff              
     
12-22-05 04:06  robang74       File Added: busybox-1.01_raf_4.diff              
     
12-22-05 04:10  robang74       Note Added: 0000806                          
12-22-05 08:12  robang74       Note Edited: 0000806                         
12-22-05 08:13  robang74       Note Edited: 0000806                         
12-22-05 08:16  robang74       Note Edited: 0000805                         
12-22-05 08:20  robang74       Note Edited: 0000337                         
12-23-05 10:23  robang74       Note Added: 0000808                          
======================================================================




More information about the busybox-cvs mailing list