[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#180567: gij-3.2: Broken zip file handling



Package: gij-3.2
Severity: normal

Hi.  From what I can tell, zip file handling under gij-3.2 seems to be
broken.  I have a transcript of a session below that shows a simple Java
program involving zip files that breaks under gij-3.2.

This interests me particularly, since Jython currently has a grave bug
against it (#180408), and a little investigation seems to trace this
problem (jython crashes on startup) back to gij's handling of zip files.
Whilst this much simplified example doesn't crash (it merely gives wrong
answers), it does clearly show that something is wrong, and I'm hoping
that both problems might have the same underlying cause.

Anyway, the transcript follows.

Thanks - Ben. :)


[ Here is a simple program that lists the contents of a zip file. ]

bab@espresso:~> cat Test.java

import java.util.zip.*;
import java.io.*;

public class Test {
    public static void main(String[] args) {
        try {
            // Open the zip file.
            FileInputStream is = new FileInputStream(args[0]);
            ZipInputStream zip = new ZipInputStream(is);

            // Write the name of each entry in the zip file.
            ZipEntry entry;
            while ((entry = zip.getNextEntry()) != null) {
                System.out.println(entry.getName());
                zip.closeEntry();
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }
}

[ Compile it. ]

bab@espresso:~> gcj-wrapper-3.2 Test.java

[ Use it to list the contents of the jar file installed by package
  libreadline-java (note that jar files are in zip format). ]

[ When we run it under gij, it's missing two files. ]

bab@espresso:~> gij-wrapper-3.2 Test
/usr/share/java/libreadline-java-0.8.0.jar META-INF/
META-INF/MANIFEST.MF
org/
org/gnu/
org/gnu/readline/
org/gnu/readline/ReadlineLibrary.class
org/gnu/readline/ReadlineReader.class

[ When we run it under the blackdown JRE, all the files show up.  ]

bab@espresso:~> java Test /usr/share/java/libreadline-java-0.8.0.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/gnu/
org/gnu/readline/
org/gnu/readline/ReadlineLibrary.class
org/gnu/readline/ReadlineReader.class
org/gnu/readline/ReadlineCompleter.class
org/gnu/readline/Readline.class

[ Let's try extracting the jar and building a zip file ourselves. ]

bab@espresso:~> jar -xf /usr/share/java/libreadline-java-0.8.0.jar
bab@espresso:~> zip -r foo.zip org
  adding: org/ (stored 0%)
  adding: org/gnu/ (stored 0%)
  adding: org/gnu/readline/ (stored 0%)
  adding: org/gnu/readline/ReadlineLibrary.class (deflated 45%)
  adding: org/gnu/readline/ReadlineReader.class (deflated 49%)
  adding: org/gnu/readline/ReadlineCompleter.class (deflated 29%)
  adding: org/gnu/readline/Readline.class (deflated 57%)

[ List the contents of the zip file to make sure we got it right. ]

bab@espresso:~> unzip -l foo.zip
Archive:  foo.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  02-11-03 21:54   org/
        0  02-11-03 21:54   org/gnu/
        0  02-11-03 21:54   org/gnu/readline/
      968  02-11-03 21:54   org/gnu/readline/ReadlineLibrary.class
     2851  02-11-03 21:54   org/gnu/readline/ReadlineReader.class
      194  02-11-03 21:54   org/gnu/readline/ReadlineCompleter.class
     5079  02-11-03 21:54   org/gnu/readline/Readline.class
 --------                   -------
     9092                   7 files

[ Off we go again; run it under the blackdown JDK and it works. ]

bab@espresso:~> java Test foo.zip
org/
org/gnu/
org/gnu/readline/
org/gnu/readline/ReadlineLibrary.class
org/gnu/readline/ReadlineReader.class
org/gnu/readline/ReadlineCompleter.class
org/gnu/readline/Readline.class

[ Run it under gij and it's still missing two files. ]

bab@espresso:~> gij-wrapper-3.2 Test foo.zip
org/
org/gnu/
org/gnu/readline/
org/gnu/readline/ReadlineLibrary.class
org/gnu/readline/ReadlineReader.class

[ That should do for now. ]

bab@espresso:~>




Reply to: