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

Chris Nauroth commented on ZOOKEEPER-2281:
------------------------------------------

Hello [~neha.bathra].  Thank you for the bug report and the patch.

The existing code works fine if the {{JAVA_HOME}} environment variable value 
wraps a path containing spaces in double quotes.  For example:

{code}
C:\zkdep\zookeeper-3.6.0-SNAPSHOT>set JAVA_HOME
JAVA_HOME="C:\Java\jdk1.7.0_75-x86 with spaces"
{code}

However, the existing code doesn't work if the environment variable value is 
not wrapped in double quotes.

{code}
C:\zkdep\zookeeper-3.6.0-SNAPSHOT>set JAVA_HOME
JAVA_HOME=C:\Java\jdk1.7.0_75-x86 with spaces
{code}

I'm guessing that your test environment was not using double quotes, which 
would explain why you were able to repro this bug.

I tested the current patch, and it makes startup work for the unquoted case, 
but it breaks startup for the quoted case, because the file existence check 
will use a path containing multiple nested quotes.  My experience is that it's 
more common to quote the environment variable value, because that also 
simplifies nested environment variable constructs, like {{set 
PATH=%JAVA_HOME%\bin;...}}.

I think we'll need to ensure backwards-compatibility if we want to proceed with 
this patch.  That likely would involve trying to check for whether or not the 
value is already quoted before wrapping our own quotes around it.

> ZK Server startup fails if there are spaces in the JAVA_HOME path
> -----------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2281
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2281
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>         Environment: Windows
>            Reporter: neha
>            Priority: Minor
>         Attachments: ZOOKEEPER-2281-00.patch, ZOOKEEPER-2281-01.patch
>
>
> Zookeeper startup fails if there are spaces in the %JAVA_HOME% variable. 
> {code}
> if not exist %JAVA_HOME%\bin\java.exe (
>   echo Error: JAVA_HOME is incorrectly set.
>   goto :eof
> )
> set JAVA=%JAVA_HOME%\bin\java
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to