Issue1208

classification
Title: jython_installer doesn't like paths that contain the '!' character
Type: crash Severity: normal
Components: Installer Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: otmarhumbel Nosy List: alv131, fwierzbicki, otmarhumbel, zyasoft
Priority: low Keywords:

Created on 2008-12-17.12:09:24 by alv131, last changed 2015-03-20.18:28:51 by zyasoft.

Files
File name Uploaded Description Edit Remove
TESTResource.java otmarhumbel, 2009-01-07.23:22:25
Messages
msg3943 (view) Author: (alv131) Date: 2008-12-17.12:09:22
E:\0\!_out\jython>java -jar jython_installer-2.2.1.jar
org.python.util.install.InstallerException: Error accessing jar file
        at org.python.util.install.JarInfo.<init>(Unknown Source)
        at org.python.util.install.Installation.internalMain(Unknown Source)
        at org.python.util.install.Installation.main(Unknown Source)
Caused by: java.io.FileNotFoundException: E:\0 (Access is denied)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:114)
        at java.util.jar.JarFile.<init>(JarFile.java:133)
        at java.util.jar.JarFile.<init>(JarFile.java:97)
        at org.python.util.install.JarInfo.readJarInfo(Unknown Source)
        ... 3 more

E:\0\!_out\jython>java -jar jython_installer-2.5b0.jar
org.python.util.install.InstallerException: Error accessing jar file
        at org.python.util.install.JarInfo.<init>(JarInfo.java:41)
        at
org.python.util.install.Installation.internalMain(Installation.java:3
31)
        at org.python.util.install.Installation.main(Installation.java:42)
Caused by: java.io.FileNotFoundException: E:\0 (Access is denied)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:114)
        at java.util.jar.JarFile.<init>(JarFile.java:133)
        at java.util.jar.JarFile.<init>(JarFile.java:97)
        at org.python.util.install.JarInfo.readJarInfo(JarInfo.java:124)
        at org.python.util.install.JarInfo.<init>(JarInfo.java:39)
        ... 2 more

E:\0\!_out\jython>
msg3944 (view) Author: Oti Humbel (otmarhumbel) Date: 2008-12-17.12:46:36
The ! is used as jar file separator, such as:

jar:file:/E:/0/!_out/jython/jython_installer-2.2.1.jar!/org/python/util/install/JarInfo.class

the installer should search it from the end of the path, not from the
beginning.
msg3997 (view) Author: Oti Humbel (otmarhumbel) Date: 2008-12-31.13:33:46
The installer itself is easy to fix, but the additional problem is that 
the jdk methods 
  Class.getResourceAsStream()
and 
  ClassLoader.getResourceAsStream()
fail if there is a ! in the class path

At the moment this is only a guess, but if this turns out to be true it 
would be almost impossible to support Jython in a directory containing a 
n exclamation mark
msg4009 (view) Author: Oti Humbel (otmarhumbel) Date: 2009-01-07.23:22:25
http://jython.svn.sourceforge.net/viewvc/jython?view=rev&revision=5867 
fixes the installation part.

But as the attached TESTResource.java demonstrates, java itself has a 
problem delivering Class.getResourceAsStream() from inside a .jar file, 
if this .jar file is below a directory containing an exclamation mark.

Since we are making heavy usage of getResourceAsStream(), this means:
 - installer autotests cannot run
 - jython does not startup if installed into a directory containing a 
'!'

To reproduce the java problem mentioned above:
 - compile TESTResource.java
 - put the class file into test.jar, in package st.extreme.jython
 - add a text file my.resource into the same directory st/extreme/jython 
inside test.jar
 - copy test.jar into a directory containing a '!'
 - run the following java command:
java -classpath test.jar st.extreme.jython.TESTResource
 - and it will complain about a null resource stream
msg4010 (view) Author: Oti Humbel (otmarhumbel) Date: 2009-01-08.09:45:34
The getResourceAsStream() behaviour is not consistent over java versions
and platforms.
I need some more time to test a couple of combinations.
msg4058 (view) Author: Oti Humbel (otmarhumbel) Date: 2009-01-18.14:16:27
With http://jython.svn.sourceforge.net/viewvc/jython?
view=rev&revision=5946, installation of jython and starting jython from 
a directory containing an exclamation mark is now possible.

However, there are some restriction for running, mainly:
 - only on jdk 1.6 or higher
 - not on windows

Please find the details in the checkin comment of revision 5946.

I'll certainly still try to get jython.bat running for this special 
case, but with lower priority.
msg7790 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-26.17:18:53
Since the solution involves JDK6 it can only go into 2.7.
msg9615 (view) Author: Jim Baker (zyasoft) Date: 2015-03-10.18:54:46
With the work in msg4009 completed, sounds like this has been fixed with Jython 2.7's requirement of using Java 7

Resolving accordingly
History
Date User Action Args
2015-03-20 18:28:51zyasoftsetstatus: pending -> closed
2015-03-10 18:54:46zyasoftsetstatus: open -> pending
resolution: fixed
messages: + msg9615
nosy: + zyasoft
2013-02-26 17:18:53fwierzbickisetmessages: + msg7790
versions: + Jython 2.7
2013-02-26 17:17:45fwierzbickisetnosy: + fwierzbicki
2009-03-14 14:14:31fwierzbickisetpriority: low
2009-01-18 14:16:29otmarhumbelsetmessages: + msg4058
2009-01-08 09:45:34otmarhumbelsetmessages: + msg4010
2009-01-07 23:22:26otmarhumbelsetfiles: + TESTResource.java
messages: + msg4009
2008-12-31 13:33:46otmarhumbelsetmessages: + msg3997
2008-12-17 12:46:37otmarhumbelsetassignee: otmarhumbel
messages: + msg3944
nosy: + otmarhumbel
2008-12-17 12:09:24alv131create