Bug 916960

Summary: Standalone.bat does not work if parentheses are on path to EAP.
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Petr Kremensky <pkremens>
Component: Scripts and CommandsAssignee: James Perkins <jperkins>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: jperkins, rdickens, rsvoboda, sgilda, smumford
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
In previous releases of JBoss EAP, batch files provided - e.g. `standalone.bat` and `add-user.bat` failed to work as expected on Microsoft Windows Server if the path in which they were stored contained parentheses or spaces. The batch files have been improved by use of quotation characters to ensure that the full path is evaluated. As a result, the batch files now works as expected with paths including parentheses and spaces.
Story Points: ---
Clone Of:
: 963986 (view as bug list) Environment:
windows
Last Closed: 2013-12-15 16:17:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 963986    

Description Petr Kremensky 2013-03-01 10:15:44 UTC
I am unable to run standalone.bat if path to EAP contains parentheses.

W:\pkrmens\Program Files (x86)\jboss-eap-6.1\bin>standalone.bat
\jboss-eap-6.1 was unexpected at this time.

domain.bat, standalone.sh and standalone.bat works fine

Comment 1 Petr Kremensky 2013-03-01 10:21:50 UTC
updating last line of my previous comment:
domain.bat, standalone.sh and domain.sh works fine

Comment 2 Permaine Cheung 2013-03-20 13:48:20 UTC
Jason, can you please look into this? Thanks!

Comment 3 Petr Kremensky 2013-04-24 11:34:47 UTC
Is there any news on this? 

"C:\Program Files (x86)\EAP-6.1.0" is default installation path on windows (when using installer). User won't be able to run EAP in standalone mode neither by using start-menu shortcut nor by directly invoking standalone.bat script, if he choose default installation path.

Comment 4 Scott Mumford 2013-05-15 22:37:45 UTC
Any movement on this?
Is it resolved? A known issue?

More information is required before this can be included in the 6.1.0 Release Notes.

Comment 5 sgilda 2013-05-16 16:41:59 UTC
Russell, Petr, James Perkins, and I spent some time debugging this. It turns out the problem is with line 77 of the script:
   echo             JBOSS_HOME: %JBOSS_HOME%

It is located within this "if" statement:

if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
   echo.
   echo   WARNING:  JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
   echo.
   echo             JBOSS_HOME: %JBOSS_HOME%
   echo.
   rem 2 seconds pause
   ping 127.0.0.1 -n 3 > nul
)

The echoed directory name contains an ending parenthesis and DOS thinks that it ends the "if" statement. 

Basically, it's processing it like this:

if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
   echo.
   echo   WARNING:  JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
   echo.
   echo             JBOSS_HOME: C:\Program Files (x86
)
\jboss-eap-6.1

It has no idea what to do with "\jboss-eap-6.1"

The work-around is to put double quotes around the %JBOSS_HOME% at line 77 as follows:

echo             JBOSS_HOME: "%JBOSS_HOME%"

Comment 6 sgilda 2013-05-16 17:02:19 UTC
Scott, here's something to get you started with the release notes:

If you use the Windows installer and install JBoss Enterprise Platform 6.1 to a default directory containing parentheses, for example "C: Program Files (x86)\jboss-eap-6.1", the standalone.bat file may fail with a message "\jboss-eap-6.1 was unexpected at this time". This is because the DOS processor interprets the ending parenthesis in the echoed JBoss path name as the end of the preceding "if" statement.

To resolve this issue:

1. Open the JBOSS_HOME\bin\standalone.bat file in an editor.

2. Find line 77 in the file. It should be:

   echo             JBOSS_HOME: %JBOSS_HOME%

3. Edit the line by putting double-quotes around the %JBOSS_HOME% as follows:

   echo             JBOSS_HOME: "%JBOSS_HOME%"

Comment 7 sgilda 2013-05-16 19:25:29 UTC
It appears there are additional problems with the scripts. 

For example, if you have defined a JBOSS_HOME environment variable, it executes differently depending on whether it is defined with quotes or without quotes. For example:

SET JBOSS_HOME="C:\Program Files (x86)\jboss-eap-6.1"
runs into an issue with this line:

if "x%JBOSS_HOME%" == "x"

SET JBOSS_HOME=C:\Program Files (x86)\jboss-eap-6.1 
runs into other issues.

James is looking into this further.

Comment 8 Scott Mumford 2013-05-17 01:16:38 UTC
Thanks Sande.

I've added a release note based on your findings.

Comment 9 James Perkins 2013-05-17 01:45:55 UTC
Upstream PR for the fix https://github.com/wildfly/wildfly/pull/4520

Comment 10 JBoss JIRA Server 2013-05-17 15:16:15 UTC
James Perkins <jperkins> made a comment on jira WFLY-1358

Pull request merged.

Comment 11 Petr Kremensky 2013-10-08 10:14:42 UTC
I retested this with latest EAP build and the issue is fixed.

Verified on EAP 6.2.0.ER5.

Comment 12 Russell Dickenson 2013-11-21 01:59:18 UTC
Release notes text added for inclusion in the JBoss EAP 6.2.0 Release Notes document.