> This fix made equal processing of strings such as ""C:\\Program 
> Files\\Git\\"" before and after JDK-8250568.
> 
> For example, it's needed to execute the following command on Windows:
> `C:\Windows\SysWOW64\WScript.exe "MyVB.vbs" "C:\Program Files\Git" "Test"`
> it's equal to:
> `new ProcessBuilder("C:\\Windows\\SysWOW64\\WScript.exe", "MyVB.vbs", 
> ""C:\\Program Files\\Git\\"", "Test").start();`
> 
> While processing, the 3rd argument ""C:\\Program Files\\Git\\"" treated as 
> unquoted due to the condition added in JDK-8250568.
> 
>     private static String unQuote(String str) {
>     .. 
>        if (str.endsWith("\\"")) {
>             return str;    // not properly quoted, treat as unquoted
>         }
>     ..
>     }
> 
> 
> that leads to the additional surrounding by quotes in 
> ProcessImpl::createCommandLine(..) because needsEscaping(..) returns true due 
> to the space inside the string argument.
> As a result the native function CreateProcessW 
> (src/java.base/windows/native/libjava/ProcessImpl_md.c) gets the incorrectly 
> quoted argument: 
> 
> pcmd = C:\Windows\SysWOW64\WScript.exe MyVB.vbs ""C:\Program Files\Git"" Test
> (jdk.lang.Process.allowAmbiguousCommands = true)
> pcmd = "C:\Windows\SysWOW64\WScript.exe" MyVB.vbs ""C:\Program Files\Git\\"" 
> Test
> (jdk.lang.Process.allowAmbiguousCommands = false)
> 
> 
> Obviously, a string ending with `"\\""` must not be started with `"""` to 
> treat as unquoted overwise it’s should be treated as properly quoted.

Olga Mikhaltsova has updated the pull request incrementally with one additional 
commit since the last revision:

  Add a new line to the end of test file for JDK-8282008

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/7504/files
  - new: https://git.openjdk.java.net/jdk/pull/7504/files/6a2c82f9..0eceecac

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7504&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7504&range=01-02

  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7504.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7504/head:pull/7504

PR: https://git.openjdk.java.net/jdk/pull/7504

Reply via email to