[erlang-patches] [PATCH] Zip archives disk numbering

Henrik Nord <>
Fri Jul 6 15:17:23 CEST 2012


Thank you

I grabbed

git fetch git://github.com/pguyot/otp.git fix-zip-multidisk

;)



On 06/18/2012 03:26 PM, Paul Guyot wrote:
> Hello,
>
> There is a bug in zip.erl: archives are wrongly created with the central directory's disk_num_start set to 1. The specification is not extremely clear about the base number of this value, however zip.erl uses 0 everywhere else for the disk number. Besides, this bug causes some incompatibility with other software that insists in reading 0 as disk_num_start or otherwise consider that the archive is multidisk. This is the case with Microsoft Office applications. For example, the following code tests for 0:
> http://code.google.com/p/xmind-merger/source/browse/OpenXmlManager/Internal/IO/Zip/ZipIOCentralDirectoryFileHeader.cs#204
>
> You will find a patch against 'maint' here:
> git fetch git://github.com/pguyot/otp.git fix-multidisk-zip
> https://github.com/pguyot/otp/commit/da11eb78dac39940edf4dcfbb47b438493345598
>
> This patch simply fixes the single buggy line. It does not include a test. Indeed, I am confused about the best way to test this fix. zip_SUITE tests in maint branch are mostly about extracting files from zip archives, and there is no comparison or binary matching of the output of zip:create/{2,3} function. If a test is required for inclusion, please let me know the best approach for designing such a test, and I will gladly provide an amended patch.
>
> Regards,
>
> Paul

-- 
/Henrik Nord Erlang/OTP



More information about the erlang-patches mailing list