groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Milles (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (GROOVY-8295) Groovyc ant task can overflow Windows command line if classpath is large
Date Tue, 12 Dec 2017 19:45:00 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-8295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16288152#comment-16288152
] 

Eric Milles edited comment on GROOVY-8295 at 12/12/17 7:44 PM:
---------------------------------------------------------------

Quick summary: current fix for this issue in Groovy 2.4 branch works perfectly in forked compilation
mode.  In-process compilation is failing due to difference between project basedir and working
directory (as mentioned in previous comment).

Changing {{getClasspathRelative}} as described above works in forked compilation mode.  Although
it alters the working directory from what existing builds have been using.  This same change
is not helping in-process compilation.  Ant appears to be validating the classpath resources
against the project basedir and the FileSystemCompiler loads relative to the working directory.

If {{getClasspathRelative}} did not alter the classpath for in-process compilation, there
would be no other conflict with the fix.  That is, check {{fork}} flag.


was (Author: emilles):
Quick summary: current fix for this issue in Groovy 2.4 branch works perfectly in forked compilation
mode.  In-process compilation is failing due to difference between project basedir and working
directory (as mentioned in previous comment).

Changing {{getClasspathRelative}} as described above works in forked compilation mode.  Although
it alters the working directory from what existing builds have been using.  This same change
is not helping in-process compilation.  Ant appears to be validating the classpath resources
against the project basedir and the FileSystemCompiler loads relative to the working directory.

If {{getClasspathRelative}} was not called for in-process compilation, there would be no other
conflict with the fix.  That is, replace {{commandLineList.add(getClasspathRelative(classpath));}}
with {{commandLineList.add(classpath.toString());}} only in {{doNormalCommandLineList}}.

> Groovyc ant task can overflow Windows command line if classpath is large
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-8295
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8295
>             Project: Groovy
>          Issue Type: Bug
>          Components: Ant integration
>         Environment: Windows
>            Reporter: Eric Milles
>            Assignee: Paul King
>             Fix For: 2.4.14
>
>         Attachments: Groovyc.patch
>
>
> The groovyc ant adapter tries to account for the 32K command line length limit on windows
in its addSourceFiles method.  However, if the command line gets long for other reasons --
we include a number of libraries in our compiled projects -- the command line can still be
overflown.
> This results in:
> {code}
> CompileAntScript.xml:129: Error running forked groovyc.
> 	at org.codehaus.groovy.ant.Groovyc.runForked(Groovyc.java:1121)
> 	at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:1214)
> 	at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:831)
> Caused by: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_60\jre\bin\java":
CreateProcess error=206, The filename or extension is too long
> 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
> 	at java.lang.Runtime.exec(Runtime.java:620)
> 	at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
> 	at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
> 	at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
> 	at org.codehaus.groovy.ant.Groovyc.runForked(Groovyc.java:1119)
> 	... 31 more
> Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is
too long
> 	at java.lang.ProcessImpl.create(Native Method)
> 	at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
> 	at java.lang.ProcessImpl.start(ProcessImpl.java:137)
> 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
> 	... 36 more
> {code}
> Would it be possible to add command line length checking to {{runForked}} instead of
{{addSourceFiles}} and use a command file for groovyc to prevent command line overflow?  Without
this, we are having to use a lot of verbose workarounds in Ant.
> https://github.com/apache/groovy/blob/master/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message