On 2017-05-02, tiggersWelt.net (Support) <supp...@tiggerswelt.net> wrote:
> Am 01.05.2017 um 22:40 schrieb Grant Edwards:
>> 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?
>
> Just to give you a short answer (without having fixed the issue yet):
>
> At the point of error (unzip.c:656) busybox is not prepared to handle a
> Central-Directory-End-Magic (0x06054B50), but the ZIP-File seems valid [0].

Yes, I'm pretty sure it's valid.  I've got several different utilities
that produce that identical file when you tell them to create a zip
archive of an empty directory (or when you delete the last file in a
zip archive).  I've also found numerous references saying that an
empty zip file comprises those exact 22 bytes and show other ways to
create one:

http://stackoverflow.com/questions/25195495/how-to-create-an-empty-zip-file
http://stackoverflow.com/questions/29234912/how-to-create-minimum-size-empty-zip-file-which-has-22b

> It should be easy to catch the signature there and just stop processing.
> But as I'm new to this code, I don't know if there are any side-effects.
>
> [0] https://www.iana.org/assignments/media-types/application/zip
>     See "General Format of a ZIP file" - everything is optional
>     except a CDE at EOF (which may also be BOF if no other parts are
>     present)

-- 
Grant Edwards               grant.b.edwards        Yow! I think my career
                                  at               is ruined!
                              gmail.com            

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to