Skip to content

IZPACK-1799 Bug fix: Wrong regex in JarMerge #1057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

jmalopoy
Copy link
Contributor

Proposal of fix for IZPACK-1799.

@reinhapa
Copy link
Member

@jmalopoy could you also provide a test for your change?

@jmalopoy
Copy link
Contributor Author

@reinhapa , I provided a test case triggering the issue at jmalopoy/izpack5-example-installer. Do you refer to a unit test?

@reinhapa
Copy link
Member

@reinhapa , I provided a test case triggering the issue at jmalopoy/izpack5-example-installer. Do you refer to a unit test?

Woud be nice to integrate that test into your PR. You may look into the izpack-test module and take a look at the PackagingTest as a starting point...

@reinhapa
Copy link
Member

@jmalopoy any change on this?

@jmalopoy
Copy link
Contributor Author

@reinhapa I have been unable to invest time in the integrated test :(

@reinhapa
Copy link
Member

@reinhapa I have been unable to invest time in the integrated test :(

No worries, want be a release soon...

@reinhapa
Copy link
Member

@jmalopoy I would like to understand the actual problem here. Maybe the existing JarMergeTest can be extended to catch this regression..

Could you elaborate about the cause of the problem of those duplicate entries? Seems that the Regex create logic seems to be implemented twice and could maybe extracted to a separate method.

@jmalopoy
Copy link
Contributor Author

@reinhapa Did you try the toy project I provided? If so, it should generate a corrupted uninstaller.jar and you will easily see the issue.
Unfortunately I have been unable to dig into the JarMergeTest logic to add an unit test :(

@reinhapa
Copy link
Member

@jmalopoy just run your installer but got no duplicates within the uninstaller.jar so far using IzPack 6.0.0-SNAPSHOT-c9526...

@jmalopoy
Copy link
Contributor Author

jmalopoy commented Aug 6, 2025

@reinhapa , I apologize for the late response.
I double checked the example I provided with the latest status of the master branch (commit e889b78) and the example triggers the issue. Maybe did you pick up the wrong branch? The example triggering the issue is in the broken_uninstaller_jar branch.

Anyways, I'll give you more details below:

  • JDK: OpenJDK 17.0.16+8
  • Apache Maven: 3.9.11
  • Framework: IzPack 6.0.0-SNAPSHOT-e889b

If you generate the installer and install it, it will generate the uninstaller. Inspecting the contents of the uninstaller, you will find the following entries:
jmalopoy@devbox:~/tmp/IZPACK-1799/broken/Uninstaller> jar -tf uninstaller.jar
com/izforge/izpack/uninstaller/
com/izforge/izpack/uninstaller/console/
...
uninstallerListeners
META-INF/DEPENDENCIES
META-INF/LICENSE
META-INF/NOTICE
META-INF/maven/org.apache.pdfbox/fontbox/pom.properties
META-INF/maven/org.apache.pdfbox/fontbox/pom.xml
org/apache/fontbox/cmap/GBpc-EUC-V
org/apache/fontbox/cmap/H
org/apache/fontbox/cmap/H/Kscs-B5-H
org/apache/fontbox/cmap/H/Kscs-B5-V
org/apache/fontbox/cmap/KSCms-UHC-H
org/apache/fontbox/cmap/KSCms-UHC-H/W-H
org/apache/fontbox/cmap/KSCms-UHC-H/W-V
org/apache/fontbox/cmap/UniJIS-UCS2-H
org/apache/fontbox/cmap/UniJIS-UCS2-H/W-H
org/apache/fontbox/cmap/UniJIS-UCS2-H/W-V
org/apache/fontbox/cmap/V

As you can see, the entry H has been added as a directory, which is wrong. Besides the entries H/Kscs-B5-H and H/Kscs-B5-V has been added, but they must not exist. Instead, the right ones which should exist are HKscs-B5-H and HKscs-B5-V

Finally, if you try to run the uninstaller, you will get the following error:
jmalopoy@devbox:~/tmp/IZPACK-1799/broken/Uninstaller> java -jar uninstaller.jar
The uninstaller has put a log file: /tmp/izpack17065414840444246128.log
/tmp/izpack17065414840444246128.d/org/apache/fontbox/cmap/H/Kscs-B5-H: Not a directory
java.nio.file.FileSystemException: /tmp/izpack17065414840444246128.d/org/apache/fontbox/cmap/H/Kscs-B5-H: Not a directory
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
at org.apache.commons.io.file.PathUtils.newOutputStream(PathUtils.java:1383)
at org.apache.commons.io.file.PathUtils.newOutputStream(PathUtils.java:1374)
at org.apache.commons.io.FileUtils.newOutputStream(FileUtils.java:2634)
at org.apache.commons.io.FileUtils.copyToFile(FileUtils.java:1079)
at com.izforge.izpack.util.SelfModifier.extractJarFile(SelfModifier.java:532)
at com.izforge.izpack.util.SelfModifier.invoke(SelfModifier.java:400)
at com.izforge.izpack.uninstaller.Uninstaller.main(Uninstaller.java:127)
Unable to exec java as a subprocess.
The uninstall may not fully complete.

Hopefully the information above will clarify the issue.
Let me know if you need further details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants