busybox unzip fails with empty zip arhcive

Denys Vlasenko vda.linux at googlemail.com
Tue May 2 16:05:25 UTC 2017


On Mon, May 1, 2017 at 10:40 PM, Grant Edwards
<grant.b.edwards at gmail.com> wrote:
> The Busybox 'unzip' utility returns a failure status and prints an
> error message when it's given an properly formatted (but empty) zip
> archive.
>
>    $ hexdump -C empty.zip
>    00000000  50 4b 05 06 00 00 00 00  00 00 00 00 00 00 00 00  |PK..............|
>    00000010  00 00 00 00 00 00                                 |......|
>    00000016
>
>    $ file empty.zip
>    empty.zip: Zip archive data (empty)
>
>    $ busybox unzip empty.zip || echo FAIL
>    Archive:  empty.zip
>    unzip: invalid zip magic 06054B50
>    FAIL
>
> Why is that an error?

Does not happen with current git:

$ ./busybox unzip z.zip ; echo $?
Archive:  z.zip
0

BTW, the archive is not liked by a "usual" unzip:

$ unzip -v
UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.
...
$ unzip z.zip ; echo $?
Archive:  z.zip
warning [z.zip]:  zipfile is empty
1


More information about the busybox mailing list