harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan Popov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4190) [jdktools][samsa][eut] Harmony JDK java wrapper strips quotes for JVM properties and program arguments
Date Thu, 21 Jun 2007 13:05:26 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506889
] 

Ivan Popov commented on HARMONY-4190:
-------------------------------------

The root cause of this problem is that samsa wrapper uses CreateProcess() from Win32 API to
launch child java process. This function requires merging all arguments into single command
line and this results in missed quotes. The problem gets worse if one uses quoted arguments
or system properties with spaces, samsa wrapper handles them incorrectly.

The simplest solution would be to use _execv() or _spawnv() functions instead of CreateProcess(),
they use array of arguments instead of single command line, and thus they should not eat quotes
or break arguments with spaces. I tried this approach, but it did not help. Functions _execv()
and _spawnl(_P_OVERLAY) return to command prompt immediately after launching child process,
this is not acceptable. Function _spawnl(_P_WAIT) works much better and behaves like CreateProcess(),
but it still eats quotes from arguments passed in the arguments array.

It seems the solution would be to use CreateProcess() or _spawnl(_P_WAIT), but detect and
escape quotes in arguments. I'll try this approach.


> [jdktools][samsa][eut] Harmony JDK java wrapper strips quotes for JVM properties and
program arguments
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4190
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4190
>             Project: Harmony
>          Issue Type: Bug
>          Components: JDK
>         Environment: Windows/x86, harmony-jdk-r547543
>            Reporter: Ivan Popov
>         Attachments: check_quotes_jdk.zip
>
>
> In addition to an issue with Harmony JRE launcher (HARMONY-4189), Harmony JDK java wrapper
strips quotes from both JVM properties and program arguments specified in command line. This
is reproduced only on Windows. On Linux JDK java wrapper works similarly to JRE java launcher.

> I'm attaching archive with simple tests and scripts, which launches tests with different
quotation. Here is results on Windows, which demonstrates the difference with RI:
> $ sh check_props.sh
> Testing quotes for JVM properties
> ====== Checking JDK\jre/bin/java ======
> *** SUN JRE output:
> foo
> foo
> "foo"
> 'foo'
> *** Harmony JRE output:
> foo
> foo
> foo
> foo
> ====== Checking JDK/bin/java ======
> *** SUN JDK output:
> foo
> foo
> "foo"
> 'foo'
> *** Harmony JDK output:
> foo
> foo
> foo
> foo
> ============ Done ============
> Testing quotes for empty JVM properties
> ====== Checking JDK/jre/bin/java ======
> *** SUN JRE output:
> ""
> ''
> *** Harmony JRE output:
> ====== Checking JDK/bin/java ======
> *** SUN JDK output:
> ""
> ''
> *** Harmony JDK output:
> ============ Done ============
> $ sh check_args.sh
> Testing quotes for program arguments
> ====== Checking JDK/jre/bin/java ======
> *** SUN JRE output:
> foo
> foo
> "foo"
> 'foo'
> *** Harmony JRE output:
> foo
> foo
> "foo"
> 'foo'
> ====== Checking JDK/bin/java ======
> *** SUN JDK output:
> foo
> foo
> "foo"
> 'foo'
> *** Harmony JDK output:
> foo
> foo
> foo
> 'foo'
> ============ Done ============
> Testing quotes for empty program arguments
> ====== Checking JDK/jre/bin/java ======
> *** SUN JRE output:
> ""
> ''
> *** Harmony JRE output:
> ""
> ''
> ====== Checking JDK/bin/java ======
> *** SUN JDK output:
> ""
> ''
> *** Harmony JDK output:
> ''
> ============ Done ============
> This difference causes 13 EUT tests failures (org.eclipse.jdt.debug.tests.core.ArgumentTests)
mentioned in HARMONY-4186.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message