zcat: failure to correctly extract files
Jack Mitchell
ml at embed.me.uk
Fri Jun 13 09:28:55 UTC 2014
I have recently upgraded to busybox v1.18.3 to v1.22.1 and seem to have
discovered a bug in zcat.
I'm not entirely sure what the problem is, but files don't seem to be
extracted correctly. The following procedure creates a basic filesytem
image, gzips it on the host then scp's it to the target where zcat fails
to properly extract it, while gunzip -c succeeds. It's very similar to
my use-case and shows the issue.
On the host:
[jack at jackArch busybox-test]$ dd if=/dev/zero of=test.img bs=1MB count=100
100+0 records in
100+0 records out
100000000 bytes (100 MB) copied, 0.157787 s, 634 MB/s
[jack at jackArch busybox-test]$ mkfs.ext3 test.img
mke2fs 1.42.9 (28-Dec-2013)
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
[jack at jackArch busybox-test]$ sudo mount test.img /mnt/tmp
[sudo] password for jack:
[jack at jackArch busybox-test]$ ls -la /mnt/tmp
total 17
drwxr-xr-x 3 root root 1024 Jun 12 17:14 .
drwxr-xr-x 10 root root 4096 Jun 9 13:18 ..
drwx------ 2 root root 12288 Jun 12 17:14 lost+found
[jack at jackArch busybox-test]$ sudo umount /mnt/tmp
[jack at jackArch busybox-test]$ dd if=test.img bs=1k | gzip -v9 > test-zcat
97656+1 records in
97656+1 records out
100000000 bytes (100 MB) copied, 0.574901 s, 174 MB/s
99.9%
[jack at jackArch busybox-test]$ scp test-zcat root at 192.168.0.254:/mnt/persist
test-zcat
100% 108KB 108.5KB/s 00:00
On the target:
target# pwd
/mnt/persist
target# ls -lah test-zcat
-rw-r--r-- 1 root root 108.5K Jun 13 09:19 test-zcat
target# time zcat test-zcat > test.img
real 0m 0.00s
user 0m 0.00s
sys 0m 0.00s
target# ls -lah test.img
-rw-r--r-- 1 root root 108.5K Jun 13 09:20 test.img
target# mount test.img /mnt/tmp/
mount: wrong fs type, bad option, bad superblock on /dev/loop4,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
target# time gunzip -c test-zcat > test2.img
real 0m 1.90s
user 0m 1.31s
sys 0m 0.58s
target# ls -lah test2.img
-rw-r--r-- 1 root root 95.4M Jun 13 09:21 test2.img
target# mount test2.img /mnt/tmp/
target# ls -la /mnt/tmp/
drwxr-xr-x 3 root root 1024 Jun 12 16:14 .
drwxr-xr-x 9 root root 4096 Jun 12 16:32 ..
drwx------ 2 root root 12288 Jun 12 16:14 lost+found
If you have any questions please let me know and I'll do my best to help.
Regards,
Jack
--
Jack Mitchell (jack at embed.me.uk)
Embedded Systems Engineer
Cambridgeshire, UK
http://www.embed.me.uk
--
More information about the busybox
mailing list