ZipOutputStream, ZipFile and Linux unzip do not agree on the file count in zip

Discussion in 'Java' started by C B, Nov 9, 2004.

  1. C B

    C B Guest

    I think there is a bug in ZipFile...

    I use ZipOutputStream to build a zip file. The program zipped 72417
    files, but after checking it with ZipFile, ZipFile.size() reported
    only 6881 files in the file. So unfortunately, Java is unable to read
    all the entries in the zip file, but Linux's PK-INFO (unzip) is able
    to read the file.


    I went on an older UNIX (non linux) server around here and tried
    unzip, it said:
    note: didn't find end-of-central-dir signature at end of central dir.
    (please check that you have transferred or created the zipfile in
    the
    appropriate BINARY mode and that you have compiled UnZip properly)

    The zip file is not corrupt, there isn't any data loss (with Linux's
    unzip I can read all entries).
    I'm using an IBM JVM, Java 1.4.2.

    Any suggestions?
     
    C B, Nov 9, 2004
    #1
    1. Advertising

  2. On 9 Nov 2004 10:52:54 -0800, C B wrote:

    > I think there is a bug in ZipFile...


    Extraordinary claims require extraordinary evidence.

    > ..Any suggestions?


    One thing that extraordinary evidence will contain is a reproducible
    example of the behaviour. For tips on that example..
    <http://www.physci.org/codes/sscce.jsp>

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
     
    Andrew Thompson, Nov 9, 2004
    #2
    1. Advertising

  3. C B

    Real Gagnon Guest

    > I think there is a bug in ZipFile...
    >
    > I use ZipOutputStream to build a zip file. The program zipped 72417
    > files, but after checking it with ZipFile, ZipFile.size() reported
    > only 6881 files in the file. So unfortunately, Java is unable to read
    > all the entries in the zip file, but Linux's PK-INFO (unzip) is able
    > to read the file.
    >


    It's possible, check this bug
    "Cannot handle zip files with more than 65535 files" at

    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5084334

    Bye.
    --
    Real Gagnon from Quebec, Canada
    * Looking for Java or PB snippets ? Visit Real's How-to
    * http://www.rgagnon.com/howto.html
     
    Real Gagnon, Nov 9, 2004
    #3
  4. Re: ZipOutputStream, ZipFile and Linux unzip do not agree on thefile count in zip

    C B wrote:
    > I use ZipOutputStream to build a zip file. The program zipped 72417
    > files, but after checking it with ZipFile, ZipFile.size() reported
    > only 6881 files in the file. So unfortunately, Java is unable to read
    > all the entries in the zip file, but Linux's PK-INFO (unzip) is able
    > to read the file.


    If you subtract the numbers, you will get a very familiar number (old
    trick in such cases - play with the numbers. Looking at the binary
    representation also often provides clues). Here the result indicates
    that you most likely have a short (16 bit) integer overflow. I can't
    tell you if this happens in your code, in Sun's Java code, in the C ZIP
    library use by Sun, or if this might even be a limitation of the ZIP
    file format.

    /Thomas
     
    Thomas Weidenfeller, Nov 10, 2004
    #4
  5. C B

    Chris Uppal Guest

    Thomas Weidenfeller wrote:

    > I can't
    > tell you if this happens in your code, in Sun's Java code, in the C ZIP
    > library use by Sun, or if this might even be a limitation of the ZIP
    > file format.


    It's a limit of the ZIP file format. The bug-report link that Real posted has
    some more detail.

    -- chris
     
    Chris Uppal, Nov 10, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Claudio  Barradas
    Replies:
    1
    Views:
    981
    Roedy Green
    Jun 23, 2004
  2. Rocky Zhou
    Replies:
    0
    Views:
    603
    Rocky Zhou
    Apr 2, 2007
  3. Replies:
    2
    Views:
    208
    Jan Svitok
    Nov 16, 2006
  4. Jason Friedman

    python zipfile v. native unzip

    Jason Friedman, Jan 31, 2012, in forum: Python
    Replies:
    0
    Views:
    166
    Jason Friedman
    Jan 31, 2012
  5. Graham Wood
    Replies:
    3
    Views:
    600
    A. Sinan Unur
    Jan 11, 2004
Loading...

Share This Page