Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 916960 - Standalone.bat does not work if parentheses are on path to EAP.
Standalone.bat does not work if parentheses are on path to EAP.
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Scripts and Commands (Show other bugs)
6.1.0
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: James Perkins
:
Depends On:
Blocks: 963986
  Show dependency treegraph
 
Reported: 2013-03-01 05:15 EST by Petr Kremensky
Modified: 2014-05-26 21:29 EDT (History)
5 users (show)

See Also:
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 11:17:16 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker WFLY-1358 Minor Resolved Support Windows paths with spaces in batch files 2016-11-21 05:05 EST

  None (edit)
Description Petr Kremensky 2013-03-01 05:15:44 EST
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 05:21:50 EST
updating last line of my previous comment:
domain.bat, standalone.sh and domain.sh works fine
Comment 2 Permaine Cheung 2013-03-20 09:48:20 EDT
Jason, can you please look into this? Thanks!
Comment 3 Petr Kremensky 2013-04-24 07:34:47 EDT
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 18:37:45 EDT
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 12:41:59 EDT
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 13:02:19 EDT
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 15:25:29 EDT
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-16 21:16:38 EDT
Thanks Sande.

I've added a release note based on your findings.
Comment 9 James Perkins 2013-05-16 21:45:55 EDT
Upstream PR for the fix https://github.com/wildfly/wildfly/pull/4520
Comment 10 JBoss JIRA Server 2013-05-17 11:16:15 EDT
James Perkins <jperkins@redhat.com> made a comment on jira WFLY-1358

Pull request merged.
Comment 11 Petr Kremensky 2013-10-08 06:14:42 EDT
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-20 20:59:18 EST
Release notes text added for inclusion in the JBoss EAP 6.2.0 Release Notes document.

Note You need to log in before you can comment on or make changes to this bug.