You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2020/11/09 22:08:02 UTC

[Bug 64912] New: [javac] Task regression between 1.10.6 and 1.10.8

https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

            Bug ID: 64912
           Summary: [javac] Task regression between 1.10.6 and 1.10.8
           Product: Ant
           Version: 1.10.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: rothwell@amazon.com
  Target Milestone: ---

Created attachment 37552
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37552&action=edit
patch as described in issue description

## Problem

Triggered regression:
https://github.com/apache/ant/commit/15fcc941e01cb127bd2b137d88ed702dea6afa46#diff-91c4932c8be4bf0200b9885eac1d0f1052b4561e2c8f99fffcf874272dc56769R75

If an argument contains '#', it must be quoted in the JVM arg file as well.

Before, the classpath did not get included in arg file, so quoting was not
necessary.

Now, the classpath goes to the arg file, so it must be quoted.


## Proposed solution:

https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java#L552

1. `if (quoteFiles && args[i].contains(" ")) {`
2. `if (quoteFiles && Pattern.compile("[ #]").matcher(args[i]).find()) {`

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #14 from Jaikiran Pai <ja...@apache.org> ---
I've pushed a commit[1] upstream which now quotes the # character too. The
patch is similar to TJ Rothwell's except for minor changes plus additional test
additions.

[1]
https://github.com/apache/ant/commit/7efd6d0c4f62a39df452cc6e834a8e02f1e7f6ad/

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |1.10.10

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

TJ Rothwell <ro...@amazon.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tj.rothwell@gmail.com

--- Comment #1 from TJ Rothwell <ro...@amazon.com> ---
*** Bug 64911 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #12 from Stefan Bodewig <bo...@apache.org> ---
quoting the arg would work for both version of javac?

In that case I'd say let's change the implementation, it wouldn't be the first
time we've accounted for a bug in the JDK.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #13 from Jaikiran Pai <ja...@apache.org> ---
> quoting the arg would work for both version of javac?

Yes, my tests show that it works for both version of javac when the argument
containing the # character is quoted.

> In that case I'd say let's change the implementation, it wouldn't be the first time we've accounted for a bug in the JDK.

Alright then, I'll go ahead and tweak the patch proposed by @TJ Rothwell, a
bit, and try and add a testcase in our testsuite, before pushing this change.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #8 from TJ Rothwell <ro...@amazon.com> ---
I'm testing on Linux x64 using Amazon Corretto releases of OpenJDK.
> https://aws.amazon.com/corretto/

> $JAVA_HOME_8/bin/javac -version
javac 1.8.0_252

> $JAVA_HOME_11/bin/javac -version
javac 11.0.7

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #9 from TJ Rothwell <ro...@amazon.com> ---
Since we don't know what the right "fix" is yet, consider reverting the change
that triggered this regression.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #10 from Jaikiran Pai <ja...@apache.org> ---
Hello @TJ Rothwell,

> $JAVA_HOME_11/bin/javac -version
> javac 11.0.7

Do you mean you are able to reproduce this on 11.0.x versions too (on Amazon
Corretto)?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #4 from Jaikiran Pai <ja...@apache.org> ---
Hello @TJ Rothwell,

I looked into this a bit more and read up on
https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9__BHCJEIBB.
That document only says that the argument values need to be quoted if the value
contains the space character. It says nothing about the # sign. So I tried out
the following (outside of Ant) on Java 11 installation:

The args file (args.txt):

-d del#me

Then:

$JAVA_HOME/bin/javac @args.txt Foo.java

JAVA_HOME points to Java 11 installation. This works fine without any issues
and the compiled class gets generated in the del#me directory.

Then I switched to Java 8 installation (1.8.0_265) and ran the same thing
again. This time it fails with:

javac: directory not found: del
Usage: javac <options> <source files>
use -help for a list of possible options

If I then edit the args.txt to quote the directory value as follows:

-d "del#me"

then the same command works fine on Java 8.

Given that the documentation doesn't state any requirement for quoting the #
character and the fact that this is working fine on Java 11, I suspect this is
a bug in javac itself (in the Java 8 version) and not an Ant issue.

Can you tell us which vendor and version of Java you are using to reproduce
this issue?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #6 from Jaikiran Pai <ja...@apache.org> ---
I've opened https://bugs.openjdk.java.net/browse/JDK-8256815 to get inputs from
the JDK team.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #7 from Jaikiran Pai <ja...@apache.org> ---
There's another issue reported here
https://bz.apache.org/bugzilla/show_bug.cgi?id=64790 which appears to be same
as this one.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #2 from TJ Rothwell <ro...@amazon.com> ---
ping?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #5 from Jaikiran Pai <ja...@apache.org> ---
For the sake of completion, I also checked the Java 8 documentation for the
javac tool[1], that one too doesn't say anything about # character requiring
quoting.

[1]
https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javac.html#BHCJEIBB

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #11 from TJ Rothwell <ro...@amazon.com> ---
The issue was only encountered with v8.

v8 = regression
v11 = no regression

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

--- Comment #3 from Jaikiran Pai <ja...@apache.org> ---
Thank you for reporting this. We have had some regressions in this area
recently with the changed code. Would it be possible to attach a build file to
reproduce this? That will help us quickly test it out. If not, I will try and
come up with one myself this weekend.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64912] [javac] Task regression between 1.10.6 and 1.10.8

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64912

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xma@tibco.com

--- Comment #15 from Jaikiran Pai <ja...@apache.org> ---
*** Bug 64790 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.