www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13160] New: ZipArchive.directory do not support read files

https://issues.dlang.org/show_bug.cgi?id=13160

          Issue ID: 13160
           Summary: ZipArchive.directory do not support read files with
                    more than 65000 entries
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: mingodad gmail.com

Reading a post on D language forum I saw an answer with a snippet to read big
zip files using memory mapped files, when I tried it with a zip file with more
than 65000 entries it fails with:
----
std.zip.ZipException ../../../../src/libphobos/src/std/zip.d(49): ZipException:
invalid directory entry 3
----------------
./zipTest() [0x403aca]
./zipTest() [0x41486f]
./zipTest() [0x414fcf]
./zipTest() [0x415200]
./zipTest() [0x414fcf]
./zipTest() [0x415168]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f5c4e90e76d]
./zipTest() [0x4038b9]
----------------
======
import std.stdio, std.zip, std.file, std.mmfile;

int main()
{
  auto mmfile = new MmFile(File("more-than-65000-entries.zip", "rb"));
  auto zip = new ZipArchive(mmfile[]);
  foreach (item; zip.directory) {
    writeln("processing ", item.name, " ...");
    // processing item...
  }
  return 0;
}
======

--
Jul 19 2014