From fd10db6b0cbd40d3803e466e5e8c53bd85de9d64 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 02 Nov 2009 18:16:31 +0000
Subject: [PATCH] Fix for issue 4332 (Tools fail when instance path contains whitespace) The problem is in the code in charge of checking the install and instance paths and contents.  There are issues both in the scripts and in the code of org.opends.server.tools.configurator.CheckInstance.  Using quotes fixes the issue in the script and using an array of String instead of a single command-line to launch the "ls" process.

---
 opends/resource/bin/_script-util.sh |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/opends/resource/bin/_script-util.sh b/opends/resource/bin/_script-util.sh
index 47a58b4..d892176 100644
--- a/opends/resource/bin/_script-util.sh
+++ b/opends/resource/bin/_script-util.sh
@@ -145,18 +145,18 @@
 
 # Configure the appropriate CLASSPATH.
 set_classpath() {
-  CLASSPATH=${INSTANCE_ROOT}/classes
-  for JAR in ${INSTALL_ROOT}/resources/*.jar
+  CLASSPATH="${INSTANCE_ROOT}/classes"
+  for JAR in "${INSTALL_ROOT}/resources/"*.jar
   do
     CLASSPATH=${CLASSPATH}:${JAR}
   done
-  for JAR in ${INSTALL_ROOT}/lib/*.jar
+  for JAR in "${INSTALL_ROOT}/lib/"*.jar
   do
     CLASSPATH=${CLASSPATH}:${JAR}
   done
   if [ "${INSTALL_ROOT}" != "${INSTANCE_ROOT}" ]
   then
-    for JAR in ${INSTANCE_ROOT}/lib/*.jar
+    for JAR in "${INSTANCE_ROOT}/lib/"*.jar
     do
       CLASSPATH=${CLASSPATH}:${JAR}
     done
@@ -192,7 +192,7 @@
 
 if test "${INSTANCE_ROOT}" = ""
 then
-  if [ -f ${INSTALL_ROOT}/configure ]
+  if [ -f "${INSTALL_ROOT}/configure" ]
   then
     if [ -f /etc/opends/instance.loc ]
     then
@@ -218,7 +218,7 @@
       fi
     fi
   else
-    if [ -f ${INSTALL_ROOT}/instance.loc ]
+    if [ -f "${INSTALL_ROOT}/instance.loc" ]
     then
       read location < ${INSTALL_ROOT}/instance.loc
       case `echo ${location}` in
@@ -256,7 +256,7 @@
   set_java_home_and_args
   set_environment_vars
   set_classpath
-elif test "${SCRIPT_UTIL_CMD}" = "set-java-home-and-args"
+ elif test "${SCRIPT_UTIL_CMD}" = "set-java-home-and-args"
 then
   set_java_home_and_args
 elif test "${SCRIPT_UTIL_CMD}" = "set-environment-vars"
@@ -308,7 +308,7 @@
 	  OPT_CHECK_VERSION=""
       fi
   # Launch the CheckInstance process.
-      "${OPENDS_JAVA_BIN}" ${SCRIPT_NAME_ARG} -DINSTALL_ROOT=${INSTALL_ROOT} -DINSTANCE_ROOT=${INSTANCE_ROOT} org.opends.server.tools.configurator.CheckInstance --currentUser ${CURRENT_USER} ${OPT_CHECK_VERSION}
+      "${OPENDS_JAVA_BIN}" ${SCRIPT_NAME_ARG} "-DINSTALL_ROOT=${INSTALL_ROOT}" "-DINSTANCE_ROOT=${INSTANCE_ROOT}" org.opends.server.tools.configurator.CheckInstance --currentUser ${CURRENT_USER} ${OPT_CHECK_VERSION}
   # return part
       RETURN_CODE=$?
       if [ ${RETURN_CODE} -ne 0 ]

--
Gitblit v1.10.0