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

Paul Guyot pguyot@REDACTED
Mon Jun 18 15:26:55 CEST 2012


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
-- 
Semiocast            http://semiocast.com/
+33.183627948 - 20 rue Lacaze, 75014 Paris




More information about the erlang-patches mailing list