Bug 2280757 - zlibng produces different results in openjdk compressed files
Summary: zlibng produces different results in openjdk compressed files
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: zlib-ng
Version: 40
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tulio Magno Quites Machado Filho
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-05-16 08:35 UTC by Antonio Vieiro
Modified: 2024-05-16 09:16 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-05-16 09:16:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
The "pack200 --repack golden.jar" when pack200 is not using zlibng (435.23 KB, application/zip)
2024-05-16 08:53 UTC, Antonio Vieiro
no flags Details
The "pack200 --repack golden.jar" when pack200 is using zlibng (438.41 KB, application/zip)
2024-05-16 08:53 UTC, Antonio Vieiro
no flags Details
The result of "zipdump" on the bundled generated .jar file. (5.37 KB, text/plain)
2024-05-16 09:13 UTC, Antonio Vieiro
no flags Details
The result of "zipdump" on the system generated jar file. (5.37 KB, text/plain)
2024-05-16 09:14 UTC, Antonio Vieiro
no flags Details
Comparing zipdump generated files with diff zipdump-bundled.txt zipdump-system.txt > zip-diffs.txt (6.96 KB, text/plain)
2024-05-16 09:15 UTC, Antonio Vieiro
no flags Details

Description Antonio Vieiro 2024-05-16 08:35:57 UTC
java-11-openjdk in Fedora 40 is built with the `--with-zlib=bundled` flag, meaning that is uses OpenJDK's internal zlib library, and not zlibng.

Trying to build java-11-openjdk with the `--with-zlib=system`n fails on some zip and pack200 tests.

Also any other OpenJDK 11 binary (Amazon Corretto JDK11, for instance) which has been built with the `--with-zlib=system` flag (and that is using zlibng) will generate "jar" and "pack200" tools that behave differently, producing corrupted files.


Reproducible: Always

Steps to Reproduce:
Option 1:
1. Build OpenJDK at https://github.com/openjdk/jdk11 following instructions at https://github.com/openjdk/jdk11/blob/master/doc/building.md
2. Run "make run-test-tier1"

Option 2:
1. Install the "java-11-openjdk" bundled with Fedora (built using --with-zlib=bundled)
2. Install a Java 11 OpenJDK compiled using --with-zlib=system, such as Amazon Corretto [1]
3. Download the "golden.jar" file using in the Pack200 test from [2] to "golden-bundled.jar" and "golden-system.jar"
3.1. curl -L https://github.com/openjdk/jdk11/raw/master/test/jdk/tools/pack200/pack200-verifier/data/golden.jar -o golden-bundled.jar
3.2. curl -L https://github.com/openjdk/jdk11/raw/master/test/jdk/tools/pack200/pack200-verifier/data/golden.jar -o golden-system.jar
4. Repack "golden-bundled.jar" with /usr/lib/jvm/java-11-openjdk-11.0.23.0.9-1.fc40.x86_64/bin/pack200 --repack golden-bundled.jar 
5. Repack "golden-system.jar" with third-party OpenJDK11 /path/to/amazon-corretto-11/bin/pack200 --repack golden-system.jar
6. The two files differ in size:

445677 may 16 10:31 golden-bundled.jar
448934 may 16 10:30 golden-system.jar






[1] https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html
[2] https://github.com/openjdk/jdk11/raw/master/test/jdk/tools/pack200/pack200-verifier/data/golden.jar
Actual Results:  
- OpenJDK 11 does not build on Fedora 40 without the "--with-zlib=bundled"
- Java's "jar" and "pack200" in different OpenJDK versions produce different results.

Expected Results:  
- OpenJDK 11 should build on Fedora 40 with the "--with-zlib=system" configure option.
- All Java runtimes from different vendors should work the same in Fedora 40.

Comment 1 Antonio Vieiro 2024-05-16 08:53:14 UTC
Created attachment 2033505 [details]
The "pack200 --repack golden.jar" when pack200 is not using zlibng

Comment 2 Antonio Vieiro 2024-05-16 08:53:44 UTC
Created attachment 2033506 [details]
The "pack200 --repack golden.jar" when pack200 is using zlibng

Comment 3 Antonio Vieiro 2024-05-16 09:13:59 UTC
Created attachment 2033507 [details]
The result of "zipdump" on the bundled generated .jar file.

Comment 4 Antonio Vieiro 2024-05-16 09:14:39 UTC
Created attachment 2033508 [details]
The result of "zipdump" on the system generated jar file.

Comment 5 Antonio Vieiro 2024-05-16 09:15:16 UTC
Created attachment 2033509 [details]
Comparing zipdump generated files with diff zipdump-bundled.txt zipdump-system.txt > zip-diffs.txt

Comment 6 Antonio Vieiro 2024-05-16 09:16:53 UTC
After some research the bug is not generated by zlibng. It's just that zlibng compresses entries with different ratios than zlib.

The tests in the OpenJDK should be updated to not take into account the sizes of the generated files instead.

Apologies for the noise!


Note You need to log in before you can comment on or make changes to this bug.