Bug 982378

Summary: new jpackage breaks groovy and custom classpath
Product: [Fedora] Fedora Reporter: Aleksandar Kostadinov <akostadi>
Component: groovyAssignee: Matt Spaulding <mspaulding06>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 18CC: akurtako, dbhole, jerboaa, mizdebsk, mspaulding06, msrb, sgehwolf
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: groovy-1.8.9-4.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-30 00:42:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Groovy script patch to allow jar filenames in classpath arguments none

Description Aleksandar Kostadinov 2013-07-08 20:51:47 UTC
jpackage-utils-1.7.5-21.fc18.x86_64

After last update groovy stopped working properly with classpath. For example the command:
> groovy -cp .groovy/grapes/javax.servlet/servlet-api/jars/servlet-api-2.4.jar:.groovy/grapes/org.codehaus.groovy.modules.remote/remote-transport-http/jars/remote-transport-http-0.5.jar:.groovy/grapes/org.codehaus.groovy.modules.remote/remote-core/jars/remote-core-0.5.jar ws/JBDS/Grog/src/org/jboss/test/grog/server/GrogServer.groovy

fails with:
> /usr/bin/build-classpath: error: Could not find javax.servlet/servlet-api/jars/servlet-api-2.4.jar Java extension for this JVM
>/usr/bin/build-classpath: error: Could not find .groovy/grapes/org.codehaus.groovy.modules.remote/remote-transport-http/jars/remote-transport-http-0.5.jar Java extension for this JVM
>/usr/bin/build-classpath: error: Could not find ~/.groovy/grapes/org.codehaus.groovy.modules.remote/remote-core/jars/remote-core-0.5.jar Java extension for this JVM

This is due to the fact build-classpath only searches for JARs in specific directories and makes it impossible to specify a full path. I found that adding the following in the beginning of do_find_jar() in /usr/share/java-utils/java-functions makes it work:
>   if [ -r "$extension.jar" ] ; then
>      echo "$extension.jar"
>      return 0
>   fi

btw after last update of groovy the @Grab functionality makes groovy freeze forever. I tried enabling debug log but nothing really looks strange in there. I've no idea what the issue is but groovy is simply unusable right now.

Comment 1 Severin Gehwolf 2013-07-09 09:33:51 UTC
On line 78 on the groovy script I see this:
if [ "$1" = "-cp" -o "$1" = "-classpath" -o "$1" = "--classpath" ] ; then
    ADDITIONAL_JARS="$(echo $2 | tr ':' ' ')"
    shift 2
fi

The ADDITIONAL_JARS variable is used (if set) in the set_classpath function in /usr/share/java-utils/java-functions which in turn uses build-claspath. The intention of build-classpath is to look up jars in very specific locations. Since build-classpath is used in spec files in order to resolve the classpath and thus build against *system* jars, I don't think this is a jpackage-utils bug. The groovy script should get fixed instead.

Reassigning to the groovy component.

FWIW, this looks like a duplicate of bug 810885 to me.

Comment 2 Aleksandar Kostadinov 2013-07-09 11:22:57 UTC
I'm not sure it is a duplicate or related but for the record I see the problem with groovy-1.8.9-1.fc18.noarch

Comment 3 Matt Spaulding 2013-07-09 19:01:23 UTC
Created attachment 771195 [details]
Groovy script patch to allow jar filenames in classpath arguments

I've attached a patch with my proposed fix. I think this should solve the problem you're seeing. Passing a classpath on the command line or using the CLASSPATH environment variable should work correctly.

Comment 4 Michal Srb 2013-07-11 06:57:19 UTC
(In reply to Aleksandar Kostadinov from comment #0)
> btw after last update of groovy the @Grab functionality makes groovy freeze
> forever. I tried enabling debug log but nothing really looks strange in
> there. I've no idea what the issue is but groovy is simply unusable right
> now.

I can confirm this issue, but downgrading groovy to 1.8.7-2 doesn't seem to solve the problem. Do you remember which version of groovy worked for you?

Comment 5 Aleksandar Kostadinov 2013-07-11 07:34:14 UTC
Sorry, I'm not sure about version. I usually use the @Grap annotation so perhaps didn't use -cp in a long time.

I tried the patch proposed and it is working for me to specify classpath.

Comment 6 Fedora Update System 2013-08-18 23:26:02 UTC
groovy-1.8.9-2.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/groovy-1.8.9-2.fc18

Comment 7 Fedora Update System 2013-08-18 23:26:54 UTC
groovy-1.8.9-4.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/groovy-1.8.9-4.fc19

Comment 8 Fedora Update System 2013-08-19 21:28:36 UTC
Package groovy-1.8.9-2.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing groovy-1.8.9-2.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-15012/groovy-1.8.9-2.fc18
then log in and leave karma (feedback).

Comment 9 Aleksandar Kostadinov 2013-08-20 07:41:36 UTC
Hello, the updated package improves the situation and IMO can go to fedora updates but still the mechanism starting groovy in fedora is flawed.

To debug the unrelated bug 998815 I downloaded java from oracle and tried starting groovy with it. This means I set JAVA_HOME and PATH to point at the third party java installation and run groovy. The result is error:

> $ groovy -cp .groovy/grapes/javax.servlet/servlet-api/jars/servlet-api-2.4.jar:.groovy/grapes/org.codehaus.groovy.modules.remote/remote-transport-http/jars/remote-transport-http-0.5.jar:.groovy/grapes/org.codehaus.groovy.modules.remote/remote-core/jars/remote-core-0.5.jar /home/avalon/ws/JBDS/Grog/src/org/jboss/test/grog/server/GrogServer.groovy 
> /usr/bin/build-classpath: error: Could not find ../../jvm/java/lib/tools Java extension for this JVM
> /usr/bin/build-classpath: error: Some specified jars were not found
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> /home/avalon/ws/JBDS/Grog/src/org/jboss/test/grog/server/GrogServer.groovy: 25: unable to resolve class groovyx.remote.server.Receiver
>  @ line 25, column 1.
>    import groovyx.remote.server.Receiver;
>    ^
> 
> /home/avalon/ws/JBDS/Grog/src/org/jboss/test/grog/server/GrogServer.groovy: 24: unable to resolve class groovyx.remote.transport.http.RemoteControlHttpHandler
>  @ line 24, column 1.
>    import groovyx.remote.transport.http.RemoteControlHttpHandler;
>    ^
> 
> 2 errors

Comment 10 Fedora Update System 2013-09-30 00:42:18 UTC
groovy-1.8.9-2.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2013-09-30 00:47:22 UTC
groovy-1.8.9-4.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.