Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 572326 - dev-java/groovy-2.4.5: 'groovy --version' fails with IOException
Summary: dev-java/groovy-2.4.5: 'groovy --version' fails with IOException
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-19 06:00 UTC by anton0xf
Modified: 2019-09-14 15:38 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,7.03 KB, text/plain)
2016-01-19 06:02 UTC, anton0xf
Details
build.log (file_572326.txt,2.72 KB, text/plain)
2016-01-19 06:05 UTC, anton0xf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description anton0xf 2016-01-19 06:00:29 UTC
'groovy --version' command fails.

Issue goes from this line of stack trace: https://github.com/apache/groovy/blob/GROOVY_2_4_5/src/main/org/codehaus/groovy/reflection/GeneratedMetaMethod.java#L177 .
Reading of 'META-INF/dgminfo' fails there. The cause of which is the lack of 'dgminfo' file in groovy.jar:
# unzip -l /usr/share/groovy/lib/groovy.jar 'META-INF/*'      
Archive:  /usr/share/groovy/lib/groovy.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  01-18-2016 17:29   META-INF/
       68  01-18-2016 17:29   META-INF/MANIFEST.MF
---------                     -------
       68                     2 files



Reproducible: Always

Steps to Reproduce:
# emerge dev-java/groovy
# groovy --version
Actual Results:  
java.io.IOException: Stream closed
        at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:159)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
        at java.io.DataInputStream.readUnsignedShort(DataInputStream.java:337)
        at java.io.DataInputStream.readUTF(DataInputStream.java:589)
        at java.io.DataInputStream.readUTF(DataInputStream.java:564)
        at org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord.loadDgmInfo(GeneratedMetaMethod.java:177)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:185)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:95)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:73)
        at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
        at groovy.ui.GroovyMain.processArgs(GroovyMain.java:123)
        at groovy.ui.GroovyMain.main(GroovyMain.java:109)
Groovy Version:  JVM: 1.8.0_66 Vendor: Oracle Corporation OS: Linux


Expected Results:  
Groovy Version: 2.4.5 JVM: 1.8.0_66 Vendor: Oracle Corporation OS: Linux
Comment 1 anton0xf 2016-01-19 06:02:01 UTC
Created attachment 423314 [details]
emerge --info
Comment 2 anton0xf 2016-01-19 06:05:30 UTC
Created attachment 423316 [details]
build.log
Comment 3 Patrice Clement gentoo-dev 2016-01-19 08:06:18 UTC
Thanks a lot for filing this bug report and your thorough analysis. I did encounter this problem too after compiling but didn't dig further into it. There's a function in the Java eclasses to add additional resources to jar files so this might be solution.
Comment 4 Patrice Clement gentoo-dev 2016-01-20 13:40:08 UTC
It's going to be harder than I thought...

https://github.com/apache/groovy/blob/89135be7c627eba8fc992b9b37ff33ba062e4e97/build.gradle#L353

Basically a gradle task generates this dgminfo file prior to compile the final jar (I guess?).

!_!

Does it make ANY sense? No. But let's try to work out this bug anyway. As discussed we James yesterday in the IRC channel:
[12:46:53] [ @monsieurp ] so how would you proceed? as far as I can tell, if we want to fix this issue, we'll have to write some Java code, compile it and execute it at compile time, like the exceptionutils class

to which he replied:
[12:47:14] [ @Chewi ] it was just a problem with --version, right?
[12:48:05] [ @monsieurp ] yes
[12:48:46] [ @Chewi ] that doesn't sound like the end of the world so either it can wait or you could investigate if there's a way to run gradle just to do these nasty bits without doing the whole build

2 possible solutions:
- write a patch/class that generates the dmginfo file (compile + run in the ebuild) (we already do that with ExceptionUtils.java, see the ebuild)
- have gradle run the "dmgConverter" task

Pick your choice.
Comment 5 anton0xf 2016-01-24 11:21:08 UTC
(In reply to Patrice Clement from comment #4)
> 2 possible solutions:
> - write a patch/class that generates the dmginfo file (compile + run in the
> ebuild) (we already do that with ExceptionUtils.java, see the ebuild)
> - have gradle run the "dmgConverter" task
> 
> Pick your choice.

But gradle is not supported by portage (https://wiki.gentoo.org/wiki/Gentoo_Java_Packing_Policy#Gradle) so second way is not available.
Comment 6 Pavel Goran 2016-04-20 12:31:51 UTC
I get this exception on almost every groovy invocation (for example, when doing groovy -e 'println("abc")'). So it's not only --version that is affected.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-09-14 15:38:14 UTC
Package removed.