On 2017-05-02, Denys Vlasenko <[email protected]> wrote:
> On Mon, May 1, 2017 at 10:40 PM, Grant Edwards
><[email protected]> 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
Thanks, that's good to know. I've currently got work-arounds in my
apps to check the filesize before calling 'unzip'. Someday, I'll be
able to take out that code.
> 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
IMO,thats a bug. It's a valid zip file (you can even create it
with info-zip):
$ zip -v | head -n4
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
Currently maintained by E. Gordon. Please send bug reports to
the authors using the web page at www.info-zip.org; see README for details.
$ cp /dev/null empty
$ rm -f empty.zip
$ zip empty.zip empty
adding: empty (stored 0%)
$ zip -d empty.zip empty
deleting: empty
zip warning: zip file empty
$ 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 |......|
But, since 'zip' is a DOS thing perhaps expectations are different --
perhaps returning failure when unzipping a valid-but-empty zip file is
what DOS users expect.
--
Grant Edwards grant.b.edwards Yow! It don't mean a
at THING if you ain't got
gmail.com that SWING!!
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox