JDK-8334048 : -Xbootclasspath can not read some ZIP64 zip files
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 24,25
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2024-06-11
  • Updated: 2025-01-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
[Filing on behalf of Thomas Fitzsimmons]

It should be possible to use a Zip64 zip file on bootclasspath, however currently classes therein are not found because zip_util.c's readCEN function does not recognize the Zip64 file's signature.

Here are steps to reproduce the issue, adapted from
https://bugzilla.redhat.com/show_bug.cgi?id=1433262:

$ wget -O TestZip.java "https://bugzilla-attachments.redhat.com/attachment.cgi?id=1263973"
[...]
$ $JAVA_HOME/bin/javac TestZip.java
$ dd if=/dev/zero of=8192m count=0 bs=1 seek=8192M
[...]
$ zip 8192m.zip 8192m TestZip.class
[...]
$ rm TestZip.class
$ $JAVA_HOME/bin/java -Xbootclasspath/a:8192m.zip TestZip 8192m.zip
Error: Could not find or load main class TestZip
Caused by: java.lang.ClassNotFoundException: TestZip
$

After applying the zip_util.c patch in this pull request:

https://github.com/openjdk/jdk8u-dev/pull/452/commits/462cd916c26f9745abca2cfd78ed8d1107db9f0c#diff-8d483a644ca2cac134729b3685188e876a43697a494c9cd6e0dad1ac6d545cd4

TestZip.class is found in 8192m.zip, and the test succeeds:

$ $JAVA_HOME/bin/java -Xbootclasspath/a:8192m.zip TestZip 8192m.zip
 -> 8192m
 -> TestZip.class
Succeeded  to inspect packed file
$

This patch is based on the Java version of the same fix from JDK-8186464, which can not be directly backported to 8u due to the absence of JDK-8145260, which moves the userspace implementation to Java.  This change is thus more important for 8u because zip_util.c is the sole zip implementation there and so this also affects user code. However, it makes sense to have the logic fixed in master too.

Assuming this is accepted, I will backport it to 23, 21, 17, 11 and 8.

Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/19678 Date: 2024-06-12 14:02:58 +0000
09-07-2024