[BusyBox 0000347]: tar: Decompression failed returns exit status 0 even error happened
bugs at busybox.net
bugs at busybox.net
Sun Dec 17 18:35:49 UTC 2006
The following issue has been CLOSED
======================================================================
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: closed
Resolution: open
Fixed in Version:
======================================================================
Date Submitted: 07-21-2005 14:57 PDT
Last Modified: 12-17-2006 10:35 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-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!
:-)
----------------------------------------------------------------------
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:32
----------------------------------------------------------------------
patch n.4 adds up 368 bytes:
[roberto at wsraf busybox-1.01]$ size busybox
text data bss dec hex filename
231289 2292 36696 270277 41fc5 busybox
[roberto at 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 at wsraf busybox-1.01_raf_5]$ size busybox
text data bss dec hex filename
231593 2292 36696 270581 420f5 busybox
----------------------------------------------------------------------
robang74 - 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
----------------------------------------------------------------------
robang74 - 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 at 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
----------------------------------------------------------------------
robang74 - 01-31-06 06:05
----------------------------------------------------------------------
patch n.9 could apply cleanly to SVN while n.8 not.
----------------------------------------------------------------------
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.
----------------------------------------------------------------------
robang74 - 11-29-06 01:11
----------------------------------------------------------------------
In my opinion this bug was fixed in 1.2.2.1 at least
[root at GEDX0327 busybox-1.2.2.1]# _install/bin/busybox tar tvjf
pippo.tar.bz2
tar: Decompression failed
tar: Short header
[root at GEDX0327 busybox-1.2.2.1]# echo $?
1
----------------------------------------------------------------------
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
======================================================================
More information about the busybox-cvs
mailing list