zlib-ng / minizip-ng

Fork of the popular zip manipulation library found in the zlib distribution.
Other
1.23k stars 432 forks source link

Wrong "version needed to extract" for ZIP files compressed with bzip2 #763

Closed armijnhemel closed 8 months ago

armijnhemel commented 9 months ago

When I compress a file with bzip2 compression the wrong "version needed to extract" seems to be recorded. Instead of 4.6 it records 2.0:

$ ./minizip -b /tmp/bla.zip /bin/ls
minizip-ng 4.0.4 - https://github.com/zlib-ng/minizip-ng
---------------------------------------------------
-b /tmp/bla.zip /bin/ls 
Archive /tmp/bla.zip
Adding ls
$ file /tmp/bla.zip 
/tmp/bla.zip: Zip archive data, at least v2.0 to extract, compression method=bzip2

The ZIP specification ( https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT ) section 4.4.3.2 says that the minimum feature version should instead be 4.6:

4.6 - File is compressed using BZIP2 compression

When using the regular zip tool:

$ zip -Zb -r /tmp/bla2.zip /bin/ls
  adding: bin/ls (bzipped 56%)
$ file /tmp/bla2.zip 
/tmp/bla2.zip: Zip archive data, at least v4.6 to extract, compression method=bzip2
nmoinvaz commented 8 months ago

Thanks, I have fixed it in the develop branch.