[BusyBox 0000547]: tar archive corruption when packing unreadable files
bugs at busybox.net
bugs at busybox.net
Mon Jan 9 03:09:22 UTC 2006
The following issue has been CLOSED
======================================================================
http://busybox.net/bugs/view.php?id=547
======================================================================
Reported By: aforet
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 547
Category: Standards Compliance
Reproducibility: always
Severity: major
Priority: normal
Status: closed
Resolution: open
Fixed in Version:
======================================================================
Date Submitted: 11-16-2005 09:07 PST
Last Modified: 01-08-2006 19:09 PST
======================================================================
Summary: tar archive corruption when packing unreadable files
Description:
When trying to pack a file not readable in a tarball, the Busybox tar
applet includes an header describing the file to the tar archive, but with
no content. The resulting archive is corrupted.
For instance:
$ id
uid=500(johndoe) gid=100(users) groups=100(users)
$ ls -l file?
-rw-r--r-- 1 johndoe users 20 nov 2 2005 file1
-rw------- 1 root root 20 nov 2 2005 file2
-rw-r--r-- 1 johndoe users 20 nov 2 2005 file3
$ cat file1
this is file 1
$ cat file2
this is file 2
$ cat file3
this is file 3
$ ./busybox tar cvf test.tar file1 file2 file3
file3
file2
tar: file2: Cannot open: Permission non accordée
file1
tar: Error exit delayed from previous errors
When trying to list the content of the archive:
$ ./busybox tar tvf test.tar
-rw-r--r-- 500/100 15 2005-08-16 16:17:29 file3
-rw------- 0/0 15 2005-08-16 16:17:26 file2
tar: Invalid tar header checksum
Or when trying to extract it:
$ ./busybox tar xvf test.tar
file3
file2
tar: Invalid tar header checksum
$ cat file1
this is file 1
$ cat file2
file1$
The content of "file2" is "file1" instead of "this is file 2"!!!
Using GNU tar, the unreadable file "file2" is skipped and thus the
generated tarball is valid (it only includes file1 and file3).
======================================================================
----------------------------------------------------------------------
robang74 - 12-27-05 02:09
----------------------------------------------------------------------
AFTER PATCH:
busybox-1.01$ ./busybox tar cvzf test.tgz test; echo $?
test/
test/uno
tar: test/due: Cannot open: Permission denied
test/tre
tar: Error exit delayed from previous errors
1
busybox-1.01$ ./busybox tar tvzf test.tgz; echo $?
drwxr-xr-x 1309/100 0 2005-12-27 10:36:01 test
-rw-r--r-- 1309/100 10240 2005-12-27 10:20:26 test/uno
-rw-r--r-- 1309/100 10240 2005-12-27 10:20:42 test/tre
0
---- HOW TO REPRODUCE ERROR AND TAR COMPARISON ---
busybox-1.01$ mkdir test && cd test
test$ dd if=busybox of=uno bs=1k count=10
entrati 10+0 record
usciti 10+0 record
test$ cp uno due
test$ cp due tre
test$ chmod a-rwx due
test$ ls -al due
---------- 1 roberto users 10240 dic 27 10:20 due
test$ ..
busybox-1.01$ ./busybox tar cvzf test.tgz test
test/
test/uno
test/due
tar: test/due: Cannot open: Permission denied
test/tre
tar: Error exit delayed from previous errors
busybox-1.01$ echo $?
0
tar archive result corrupted for both bb applet and real tar command
busybox-1.01$ ./busybox tar tvzf test.tgz; echo $?
drwxr-xr-x 1309/100 0 2005-12-27 10:20:54 test
-rw-r--r-- 1309/100 10240 2005-12-27 10:20:26 test/uno
---------- 1309/100 10240 2005-12-27 10:20:39 test/due
tar: Invalid tar magic
1
busybox-1.01$ tar tvzf test.tgz; echo $?
drwxr-xr-x roberto/users 0 2005-12-27 10:20:54 test/
-rw-r--r-- roberto/users 10240 2005-12-27 10:20:26 test/uno
---------- roberto/users 10240 2005-12-27 10:20:39 test/due
tar: Salto alla prossima intestazione
tar: Uscita per errore ritardata dall'errore precedente
2
while real tar command behave better:
busybox-1.01$ tar cvzf test.tgz test; echo $?
test/
test/uno
tar: test/due: Impossibile open: Permission denied
test/tre
tar: Uscita per errore ritardata dall'errore precedente
2
busybox-1.01$ ./busybox tar tvzf test.tgz; echo $?
drwxr-xr-x 1309/100 0 2005-12-27 10:20:54 test
-rw-r--r-- 1309/100 10240 2005-12-27 10:20:26 test/uno
-rw-r--r-- 1309/100 10240 2005-12-27 10:20:42 test/tre
0
----------------------------------------------------------------------
landley - 01-08-06 19:09
----------------------------------------------------------------------
svn 13189
Issue History
Date Modified Username Field Change
======================================================================
11-16-05 09:07 aforet New Issue
11-16-05 09:07 aforet Status new => assigned
11-16-05 09:07 aforet Assigned To => BusyBox
11-17-05 00:52 aforet Issue Monitored: aforet
11-17-05 00:52 aforet Issue End Monitor: aforet
12-27-05 02:02 robang74 Issue Monitored: robang74
12-27-05 02:03 robang74 File Added: tar_bug547.diff
12-27-05 02:05 robang74 Note Added: 0000817
12-27-05 02:08 robang74 Note Edited: 0000817
12-27-05 02:09 robang74 Note Edited: 0000817
01-08-06 19:09 landley Status assigned => closed
01-08-06 19:09 landley Note Added: 0000876
======================================================================
More information about the busybox-cvs
mailing list