4

I'm using BusyBox 1.24.1 on my Embedded Linux machine (with kernel v3.10.31) and I get behavior I can't understand when unzipping files.  The gunzip command (often, but not always) fails, with no output (not even an error message), even when given a “known good” .gz file (i.e., one that I just created, using a gzip command, on the same system).  It's very hard to find a file that can actually be unzipped.  Does anyone get an "Eureka!" when looking at this?

It seems like something in the text file make the gunzip command fail, but I can't figure out what.  See below:

# ls -l
-rw-------    1 root     root            65 Sep 13 10:02 cantunzip
-rw-------    1 root     root            64 Sep 13 10:01 canunzip
more cantunzip 
fsdgafjklsdfasdsdjfhjafasdohfkl asdfas a fsd a

2132313 12 51515
# more canunzip 
fsdgafjklsdfasdsdjfhjafasdohfkl asdfas a fsd a
2132313 12 51515
# hexdump cantunzip 
0000000 7366 6764 6661 6b6a 736c 6664 7361 7364
0000010 6a64 6866 616a 6166 6473 686f 6b66 206c
0000020 7361 6664 7361 6120 6620 6473 6120 0a0a
0000030 3132 3233 3133 2033 3231 3520 3531 3531
0000040 000a                                   
0000041
# hexdump canunzip 
0000000 7366 6764 6661 6b6a 736c 6664 7361 7364
0000010 6a64 6866 616a 6166 6473 686f 6b66 206c
0000020 7361 6664 7361 6120 6620 6473 6120 320a
0000030 3331 3332 3331 3120 2032 3135 3135 0a35
0000040
# gzip canunzip 
# gzip cantunzip 
# ls -l
-rw-------    1 root     root            77 Sep 13 10:04 cantunzip.gz
-rw-------    1 root     root            77 Sep 13 10:03 canunzip.gz
# gunzip canunzip.gz 
# echo $?
0
# gunzip cantunzip.gz
# echo $?
1
# ls -l
-rw-------    1 root     root            77 Sep 13 10:04 cantunzip.gz
-rw-------    1 root     root            64 Sep 13 10:04 canunzip
0

You can check the error code for the gunzip command which fails to unzip.

echo $?

That could give you a clue for the failure.

Taking the hexdump of the two files and comparing them might also help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.