RFR: JDK-8227641: java-options values with spaces are processed incorrectly

Andy Herrick andy.herrick at oracle.com
Fri Aug 9 14:12:27 UTC 2019

On 8/9/2019 9:25 AM, Roger Riggs wrote:
> Hi Alexander,
> I'm not sure we want to get into the business of telling people how 
> use use shell quoting.
> It does vary from shell to shell and on Windows vs. Linux.
> I'd pick one simple example that works on Windows as well as Linux.
> I would have thought that the example in the bug report would be 
> handled correctly
> since it should be delivered to java intact as a single argument. 
> ('-Dfoo=foo bar')

The problem with the original example was that the value of the 
--java-options is a space separated list of java arguments, not a single 
java argument.

We don't know if the "bar" is a second option, or part of the value of 
the first options without additional quoting like "-Dfoo='foo bar'" vs 
"-Dfoo='foo' bar", or escaping.

Since the confusion could occur in several jpackage options, I do not 
think it appropriate to address in the help text, but rather should be 
explained more fully in user documentation.


> Roger
> On 8/9/19 12:26 AM, Alexander Matveev wrote:
>> Please review the jpackage fix for bug [1] at [2].
>> This is a fix for the JDK-8200758-branch branch of the open sandbox 
>> repository (jpackage).
>> - There are no know bugs in how we handle java options with spaces. 
>> However, it might be complicated to figure out how to provide such 
>> options. Added several examples to help to show most common cases.
>>   --java-options <java options>
>>           Options to pass to the Java runtime
>>           This option can be used multiple times.
>>           Example 1: To specify [-DOption1=My Great App] use
>>            [--java-options "-DOption1=\"My Great App\""]
>>           Example 2: To specify [-DOption2="My Great App in quotes"] use
>>            [--java-options "-DOption2=\"\\\"My Great App in 
>> quotes\\\"\""]
>>           Example 3: To specify [-DOption3=Value "with" quotes] use
>>            [--java-options "-DOption3=\"Value \\\"with\\\" quotes\""]
>> Application will read them back as:
>> -DOption1=My Great App
>> -DOption2="My Great App in quotes"
>> -DOption3=Value "with" quotes
>> [1] https://bugs.openjdk.java.net/browse/JDK-8227641
>> [2] http://cr.openjdk.java.net/~almatvee/8227641/webrev.00/
>> Thanks,
>> Alexander

More information about the core-libs-dev mailing list