BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000347 [BusyBox] Standards Compliance minor always 07-21-05 14:57 12-17-06 10:35
Reporter robang74 View Status public  
Assigned To BusyBox
Priority normal Resolution fixed  
Status closed   Product Version 1.00
Summary 0000347: tar: Decompression failed returns exit status 0 even error happened
Description BEFORE (original 1.00 on the embbedded device):

root@embeslax:~# cd /tmp
root@embeslax:/tmp# dd if=/dev/zero of=pippo.tar.bz2 bs=1k count=1
1+0 records in
1+0 records out
root@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
Additional Information This patch for 1.00 may conflict with this below for 1.00:

0000262: tar -x doesn't believe it has reached the end of archive
http://busybox.net/bugs/view.php?id=262 [^]
Attached Files  busybox-1.00_raf.diff [^] (6,772 bytes) 07-21-05 14:57
 busybox-1.01_raf.diff [^] (4,845 bytes) 12-19-05 07:15
 busybox-1.01_raf_3.diff [^] (4,323 bytes) 12-21-05 12:52
 busybox-1.01_raf_4.diff [^] (6,746 bytes) 12-22-05 04:06
 busybox-1.01_raf_5.tar.gz [^] (4,866 bytes) 12-23-05 10:34
 busybox-1.01_raf_6.tar.gz [^] (5,394 bytes) 12-23-05 10:37
 busybox-1.01_raf7.tar.gz [^] (5,709 bytes) 12-27-05 02:35
 archival_n8.patch.tar.gz [^] (5,808 bytes) 12-28-05 19:31
 archival_n9.patch.tar.gz [^] (6,109 bytes) 01-31-06 06:06

- Relationships

- Notes
(0000337)
robang74
07-21-05 15:00
edited on: 12-23-05 10:42

This patch affects rpm, gunzip, bunzip2 and uncompress too.


*** PLEASE IGNORE PATCH N.1, 2 and 3 ***
please ignore patch 1, 2 and 3 because they don't work propely or don't work at all. Sorry.
:-(


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


*** ATTENTION ****
patch n.5 and 6 are NOT EXTENSIVELY tested yet due to christmas incomig...
...Marry Christmas!
:-)

 
(0000806)
robang74
12-22-05 04:10
edited on: 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@wsraf busybox-1.01]$ ls -al busybox
-rwxr-xr-x 1 roberto users 237032 dic 22 15:56 busybox*
[roberto@wsraf busybox-1.01]$ md5sum busybox
c47e7323c2a269856a6f5b46dbcf360f busybox

[roberto@wsraf busybox-1.01_raf]$ ls -al busybox
-rwxr-xr-x 1 roberto users 237032 dic 22 15:54 busybox*
[roberto@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@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@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.

 
(0000808)
robang74
12-23-05 10:23
edited on: 12-23-05 10:32

patch n.4 adds up 368 bytes:

[roberto@wsraf busybox-1.01]$ size busybox
   text data bss dec hex filename
 231289 2292 36696 270277 41fc5 busybox

[roberto@wsraf busybox-1.01_raf]$ size busybox
   text data bss dec hex filename
 231657 2292 36696 270645 42135 busybox

but the problem of returns stay in this code archival/gunzip.c

        if ((status != EXIT_SUCCESS) && (new_path)) {
            /* Unzip failed, remove new path instead of old path */
            delete_path = new_path;
        }

so patch n.5 developed using atexit instead return EXIT_FAILURE as Rob indicated me adds up 304 bytes:

[roberto@wsraf busybox-1.01_raf_5]$ size busybox
   text data bss dec hex filename
 231593 2292 36696 270581 420f5 busybox

 
(0000809)
robang74
12-23-05 10:31
edited on: 12-23-05 10:32

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 behaviour too, and some bb_error* in bb_perror*:

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

 
(0000818)
robang74
12-27-05 02:28
edited on: 12-27-05 02:30

patch n.7 fix the problem of mismatched applet name in error message and fix some compilation warnings about open_transformer


BEFORE PATCH:
./busybox tar tvzf /tmp/test.tar.gz0; echo $?
tar: unexpected end of file <---- WRONG!!
tar: child exit with error code 1
1

AFTER PATCH:
[roberto@wsraf busybox-1.01]$ ./busybox tar tvzf /tmp/test.tar.gz0; echo $?
gunzip: unexpected end of file <---- RIGHT!!
tar: child exit with error code 1
1

 
(0001024)
robang74
01-31-06 06:05

patch n.9 could apply cleanly to SVN while n.8 not.
 
(0001796)
vda
11-23-06 06:01

It's a shame that this bug sits without attention from maintainers for so long. Sorry.

Can you rediff it against current svn? Note that "uncompressors setting wrong mode" bugs are seem to be all fixed now in svn. Also please use tabs for indentation and do not mix unrelated changes into one patch. In order to get faster response, you may send patches to the mailing list. If you have broken archives which demonstrate problem, send those too.
 
(0001832)
robang74
11-29-06 01:11

In my opinion this bug was fixed in 1.2.2.1 at least

[root@GEDX0327 busybox-1.2.2.1]# _install/bin/busybox tar tvjf pippo.tar.bz2
tar: Decompression failed
tar: Short header
[root@GEDX0327 busybox-1.2.2.1]# echo $?
1
 
(0001876)
vda
12-17-06 10:35

Failed to reproduce a corner case where broken tar.bz2 unpacks into tar which is not formally "bad" but simply missing a few files.

Will add a commented-out code to tar.c which checks for that so that it can be enabled if somebody will be able to trigger it.
 

- 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
12-23-05 10:25 robang74 Note Edited: 0000337
12-23-05 10:26 robang74 Note Edited: 0000337
12-23-05 10:26 robang74 Note Deleted: 0000805
12-23-05 10:27 robang74 Note Edited: 0000808
12-23-05 10:31 robang74 Note Edited: 0000808
12-23-05 10:31 robang74 Note Added: 0000809
12-23-05 10:32 robang74 Note Edited: 0000809
12-23-05 10:32 robang74 Note Edited: 0000808
12-23-05 10:34 robang74 File Added: busybox-1.01_raf_5.tar.gz
12-23-05 10:37 robang74 File Added: busybox-1.01_raf_6.tar.gz
12-23-05 10:42 robang74 Note Edited: 0000337
12-27-05 02:28 robang74 Note Added: 0000818
12-27-05 02:30 robang74 Note Edited: 0000818
12-27-05 02:35 robang74 File Added: busybox-1.01_raf7.tar.gz
12-28-05 19:31 robang74 File Added: archival_n8.patch.tar.gz
01-31-06 06:05 robang74 Note Added: 0001024
01-31-06 06:06 robang74 File Added: archival_n9.patch.tar.gz
11-23-06 06:01 vda Note Added: 0001796
11-23-06 06:01 vda Status assigned => feedback
11-29-06 01:11 robang74 Note Added: 0001832
12-17-06 10:35 vda Status feedback => closed
12-17-06 10:35 vda Note Added: 0001876
12-17-06 10:35 vda Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker