Issue2196

classification
Title: Jython 2.7-b3 installer java.util.zip.ZipException: duplicate entry: META-INF/BCKEY.DSA
Type: crash Severity: critical
Components: Installer Versions: Jython 2.7
process
Status: pending Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: otmarhumbel, spider, zyasoft
Priority: urgent Keywords:

Created on 2014-08-27.08:18:51 by spider, last changed 2014-10-27.17:25:55 by zyasoft.

Messages
msg8939 (view) Author: Matthew Webber (spider) Date: 2014-08-27.08:18:50
I downloaded jython-installer-2.7-b3.jar and attempted to install. I specified the "standalone" option.

Unfortunately, the install fails as follows:
$ Exception in thread "Thread-6" org.python.util.install.InstallerException: Error accessing jar file
	at org.python.util.install.JarInstaller.inflate(JarInstaller.java:170)
	at org.python.util.install.ProgressPage.activate(ProgressPage.java:84)
	at org.python.util.install.AbstractWizardPage.doActivate(AbstractWizardPage.java:41)
	at org.python.util.install.AbstractWizard.showActivePage(AbstractWizard.java:414)
	at org.python.util.install.AbstractWizard.next(AbstractWizard.java:319)
	at org.python.util.install.AbstractWizard.gotoNextPage(AbstractWizard.java:215)
	at org.python.util.install.AbstractWizardValidator.fireValidationSucceeded(AbstractWizardValidator.java:78)
	at org.python.util.install.AbstractWizardValidator.access$100(AbstractWizardValidator.java:6)
	at org.python.util.install.AbstractWizardValidator$ValidatorThread.run(AbstractWizardValidator.java:16)
Caused by: java.util.zip.ZipException: duplicate entry: META-INF/BCKEY.DSA
	at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:215)
	at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
	at org.python.util.install.StandalonePackager.addJarFile(StandalonePackager.java:92)
	at org.python.util.install.JarInstaller.inflate(JarInstaller.java:156)
	... 8 more

If I did the same thing using 2.7-b2, no problems were encountered.
msg8940 (view) Author: Jim Baker (zyasoft) Date: 2014-08-27.15:38:47
duplicate entry: META-INF/BCKEY.DSA means we are trying to write this file twice. Hopefully an easy fix in the installation wizard.
msg9030 (view) Author: Jim Baker (zyasoft) Date: 2014-09-24.18:32:34
Necessary fix for beta 4
msg9057 (view) Author: Jim Baker (zyasoft) Date: 2014-09-30.16:25:37
Easiest approach for now might be to repackage the jars in extlibs/ with these duplicate entries, then revisit later.
msg9155 (view) Author: Jim Baker (zyasoft) Date: 2014-10-15.14:59:40
Let's see if we can remove the duplicates as part of build.xml. Maybe jar jar links has support?
msg9156 (view) Author: Jim Baker (zyasoft) Date: 2014-10-15.15:08:06
Some quick googling suggests we can do this with Jar Jar Links:
http://sixlegs.com/blog/java/jarjar-keep.html

Shrinking jars as described here with Jar Jar Links' dependency analysis could be very useful - we only use a tiny part of bouncycastle and icu4j for example.
msg9170 (view) Author: Jim Baker (zyasoft) Date: 2014-10-26.19:28:03
Fixed as of https://hg.python.org/jython/rev/b4e6ed051237

Because I was focused on testing, I didn't follow up on shrinking the bundled extlibs jars, but this could be readily done in a separate change.
msg9173 (view) Author: Jim Baker (zyasoft) Date: 2014-10-27.17:25:54
I did look at shrinking built jars using the keep rule for the jarjar task. This will be substantially more difficult than initially anticipated because keep means keep only classes of a certain pattern, so we have to enumerate all of these, taking in account dynamic loading. (I could not readily build a Jython that would even start up.) In addition, ICU4J, which is the real issue in terms of recent additions, does not shrink very much (maybe 10% maximum out of 10M) because most of it is composed of data files, not classes.

The one way I could see this possibly working is to use intermediate steps - build stripped versions of extlibs jars (maybe with a sub jarjar task per stripped jar), then do final linkage with the shading step provided by the jarjar task. We could also see what data files are really necessary from ICU4J, using exclusion patterns.
History
Date User Action Args
2014-10-27 17:25:55zyasoftsetmessages: + msg9173
2014-10-26 19:28:04zyasoftsetstatus: open -> pending
resolution: fixed
messages: + msg9170
2014-10-15 15:08:06zyasoftsetmessages: + msg9156
2014-10-15 14:59:41zyasoftsetmessages: + msg9155
2014-10-15 14:46:10zyasoftsetpriority: high -> urgent
assignee: otmarhumbel -> zyasoft
2014-09-30 16:25:37zyasoftsetmessages: + msg9057
2014-09-24 18:32:34zyasoftsetpriority: high
messages: + msg9030
2014-08-28 04:46:09otmarhumbelsetassignee: otmarhumbel
nosy: + otmarhumbel
2014-08-27 15:38:47zyasoftsetnosy: + zyasoft
messages: + msg8940
2014-08-27 08:18:51spidercreate