zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cami...@apache.org
Subject svn commit: r1484528 - in /zookeeper/branches/branch-3.4: CHANGES.txt bin/zkCleanup.sh bin/zkCli.sh bin/zkEnv.sh bin/zkServer.sh
Date Mon, 20 May 2013 17:09:28 GMT
Author: camille
Date: Mon May 20 17:09:28 2013
New Revision: 1484528

URL: http://svn.apache.org/r1484528
Log:
ZOOKEEPER-1663. scripts don't work when path contains spaces (Amichai Rothman via camille)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/bin/zkCleanup.sh
    zookeeper/branches/branch-3.4/bin/zkCli.sh
    zookeeper/branches/branch-3.4/bin/zkEnv.sh
    zookeeper/branches/branch-3.4/bin/zkServer.sh

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1484528&r1=1484527&r2=1484528&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Mon May 20 17:09:28 2013
@@ -66,6 +66,8 @@ BUGFIXES:
   ZOOKEEPER-1706. Typo in Double Barriers example (Jingguo Yao via fpj)
   
   ZOOKEEPER-1642. Leader Loading Database Twice (fpj via camille)
+  
+  ZOOKEEPER-1663. scripts don't work when path contains spaces (Amichai Rothman via camille)
 
 IMPROVEMENTS:
 

Modified: zookeeper/branches/branch-3.4/bin/zkCleanup.sh
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/bin/zkCleanup.sh?rev=1484528&r1=1484527&r2=1484528&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/bin/zkCleanup.sh (original)
+++ zookeeper/branches/branch-3.4/bin/zkCleanup.sh Mon May 20 17:09:28 2013
@@ -27,8 +27,8 @@
 
 # use POSTIX interface, symlink is followed automatically
 ZOOBIN="${BASH_SOURCE-$0}"
-ZOOBIN=`dirname ${ZOOBIN}`
-ZOOBINDIR=`cd ${ZOOBIN}; pwd`
+ZOOBIN="$(dirname "${ZOOBIN}")"
+ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"
 
 if [ -e "$ZOOBIN/../libexec/zkEnv.sh" ]; then
   . "$ZOOBINDIR"/../libexec/zkEnv.sh
@@ -36,16 +36,16 @@ else
   . "$ZOOBINDIR"/zkEnv.sh
 fi
 
-ZOODATADIR=$(grep "^[[:space:]]*dataDir=" "$ZOOCFG" | sed -e 's/.*=//')
-ZOODATALOGDIR=$(grep "^[[:space:]]*dataLogDir=" "$ZOOCFG" | sed -e 's/.*=//')
+ZOODATADIR="$(grep "^[[:space:]]*dataDir=" "$ZOOCFG" | sed -e 's/.*=//')"
+ZOODATALOGDIR="$(grep "^[[:space:]]*dataLogDir=" "$ZOOCFG" | sed -e 's/.*=//')"
 
 if [ "x$ZOODATALOGDIR" = "x" ]
 then
-$JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
      -cp "$CLASSPATH" $JVMFLAGS \
      org.apache.zookeeper.server.PurgeTxnLog "$ZOODATADIR" $*
 else
-$JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
      -cp "$CLASSPATH" $JVMFLAGS \
      org.apache.zookeeper.server.PurgeTxnLog "$ZOODATALOGDIR" "$ZOODATADIR" $*
 fi

Modified: zookeeper/branches/branch-3.4/bin/zkCli.sh
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/bin/zkCli.sh?rev=1484528&r1=1484527&r2=1484528&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/bin/zkCli.sh (original)
+++ zookeeper/branches/branch-3.4/bin/zkCli.sh Mon May 20 17:09:28 2013
@@ -27,8 +27,8 @@
 
 # use POSTIX interface, symlink is followed automatically
 ZOOBIN="${BASH_SOURCE-$0}"
-ZOOBIN=`dirname ${ZOOBIN}`
-ZOOBINDIR=`cd ${ZOOBIN}; pwd`
+ZOOBIN="$(dirname "${ZOOBIN}")"
+ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"
 
 if [ -e "$ZOOBIN/../libexec/zkEnv.sh" ]; then
   . "$ZOOBINDIR"/../libexec/zkEnv.sh
@@ -36,6 +36,6 @@ else
   . "$ZOOBINDIR"/zkEnv.sh
 fi
 
-$JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
      -cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS \
      org.apache.zookeeper.ZooKeeperMain "$@"

Modified: zookeeper/branches/branch-3.4/bin/zkEnv.sh
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/bin/zkEnv.sh?rev=1484528&r1=1484527&r2=1484528&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/bin/zkEnv.sh (original)
+++ zookeeper/branches/branch-3.4/bin/zkEnv.sh Mon May 20 17:09:28 2013
@@ -23,8 +23,8 @@
 # or the conf directory that is
 # a sibling of this script's directory
 
-ZOOBINDIR=${ZOOBINDIR:-/usr/bin}
-ZOOKEEPER_PREFIX=${ZOOBINDIR}/..
+ZOOBINDIR="${ZOOBINDIR:-/usr/bin}"
+ZOOKEEPER_PREFIX="${ZOOBINDIR}/.."
 
 if [ "x$ZOOCFGDIR" = "x" ]
 then
@@ -76,18 +76,19 @@ do
 done
 
 #make it work in the binary package
-if [ -e ${ZOOKEEPER_PREFIX}/share/zookeeper/zookeeper-*.jar ]; then
-  LIBPATH="${ZOOKEEPER_PREFIX}"/share/zookeeper/*.jar
+#(use array for LIBPATH to account for spaces within wildcard expansion)
+if [ -e "${ZOOKEEPER_PREFIX}"/share/zookeeper/zookeeper-*.jar ]; then
+  LIBPATH=("${ZOOKEEPER_PREFIX}"/share/zookeeper/*.jar)
 else
   #release tarball format
   for i in "$ZOOBINDIR"/../zookeeper-*.jar
   do
     CLASSPATH="$i:$CLASSPATH"
   done
-  LIBPATH="${ZOOBINDIR}"/../lib/*.jar
+  LIBPATH=("${ZOOBINDIR}"/../lib/*.jar)
 fi
 
-for i in ${LIBPATH}
+for i in "${LIBPATH[@]}"
 do
     CLASSPATH="$i:$CLASSPATH"
 done

Modified: zookeeper/branches/branch-3.4/bin/zkServer.sh
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/bin/zkServer.sh?rev=1484528&r1=1484527&r2=1484528&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/bin/zkServer.sh (original)
+++ zookeeper/branches/branch-3.4/bin/zkServer.sh Mon May 20 17:09:28 2013
@@ -44,13 +44,13 @@ fi
 
 # use POSTIX interface, symlink is followed automatically
 ZOOBIN="${BASH_SOURCE-$0}"
-ZOOBIN=`dirname ${ZOOBIN}`
-ZOOBINDIR=`cd ${ZOOBIN}; pwd`
+ZOOBIN="$(dirname "${ZOOBIN}")"
+ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"
 
 if [ -e "$ZOOBIN/../libexec/zkEnv.sh" ]; then
-  . "$ZOOBINDIR"/../libexec/zkEnv.sh
+  . "$ZOOBINDIR/../libexec/zkEnv.sh"
 else
-  . "$ZOOBINDIR"/zkEnv.sh
+  . "$ZOOBINDIR/zkEnv.sh"
 fi
 
 if [ "x$SERVER_JVMFLAGS"  != "x" ]
@@ -64,7 +64,7 @@ then
 fi
 
 # if we give a more complicated path to the config, don't screw around in $ZOOCFGDIR
-if [ "x`dirname $ZOOCFG`" != "x$ZOOCFGDIR" ]
+if [ "x$(dirname "$ZOOCFG")" != "x$ZOOCFGDIR" ]
 then
     ZOOCFG="$2"
 fi
@@ -80,15 +80,15 @@ fi
 
 echo "Using config: $ZOOCFG" >&2
 
-if [ -z $ZOOPIDFILE ]; then
-    ZOO_DATADIR=$(grep "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//')
+if [ -z "$ZOOPIDFILE" ]; then
+    ZOO_DATADIR="$(grep "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//')"
     if [ ! -d "$ZOO_DATADIR" ]; then
         mkdir -p "$ZOO_DATADIR"
     fi
     ZOOPIDFILE="$ZOO_DATADIR/zookeeper_server.pid"
 else
     # ensure it exists, otw stop will fail
-    mkdir -p $(dirname "$ZOOPIDFILE")
+    mkdir -p "$(dirname "$ZOOPIDFILE")"
 fi
 
 if [ ! -w "$ZOO_LOG_DIR" ] ; then
@@ -100,13 +100,13 @@ _ZOO_DAEMON_OUT="$ZOO_LOG_DIR/zookeeper.
 case $1 in
 start)
     echo  -n "Starting zookeeper ... "
-    if [ -f $ZOOPIDFILE ]; then
-      if kill -0 `cat $ZOOPIDFILE` > /dev/null 2>&1; then
-         echo $command already running as process `cat $ZOOPIDFILE`. 
+    if [ -f "$ZOOPIDFILE" ]; then
+      if kill -0 `cat "$ZOOPIDFILE"` > /dev/null 2>&1; then
+         echo $command already running as process `cat "$ZOOPIDFILE"`. 
          exit 0
       fi
     fi
-    nohup $JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
+    nohup "$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
     -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" > "$_ZOO_DAEMON_OUT" 2>&1 <
/dev/null &
     if [ $? -eq 0 ]
     then
@@ -124,15 +124,15 @@ start)
     fi
     ;;
 start-foreground)
-    ZOO_CMD="exec $JAVA"
+    ZOO_CMD=(exec "$JAVA")
     if [ "${ZOO_NOEXEC}" != "" ]; then
-      ZOO_CMD="$JAVA"
+      ZOO_CMD=("$JAVA")
     fi
-    $ZOO_CMD "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
+    "${ZOO_CMD[@]}" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
     -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG"
     ;;
 print-cmd)
-    echo "$JAVA -Dzookeeper.log.dir=\"${ZOO_LOG_DIR}\" -Dzookeeper.root.logger=\"${ZOO_LOG4J_PROP}\"
-cp \"$CLASSPATH\" $JVMFLAGS $ZOOMAIN \"$ZOOCFG\" > \"$_ZOO_DAEMON_OUT\" 2>&1 <
/dev/null"
+    echo "\"$JAVA\" -Dzookeeper.log.dir=\"${ZOO_LOG_DIR}\" -Dzookeeper.root.logger=\"${ZOO_LOG4J_PROP}\"
-cp \"$CLASSPATH\" $JVMFLAGS $ZOOMAIN \"$ZOOCFG\" > \"$_ZOO_DAEMON_OUT\" 2>&1 <
/dev/null"
     ;;
 stop)
     echo -n "Stopping zookeeper ... "
@@ -149,7 +149,7 @@ stop)
 upgrade)
     shift
     echo "upgrading the servers to 3.*"
-    $JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
+    "$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
     -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.server.upgrade.UpgradeMain ${@}
     echo "Upgrading ... "
     ;;
@@ -161,7 +161,7 @@ restart)
     ;;
 status)
     # -q is necessary on some versions of linux where nc returns too quickly, and no stat
result is output
-    STAT=`$JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
+    STAT=`"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
              -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain localhost
\
              $(grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//') srvr 2> /dev/null
   \
           | grep Mode`



Mime
View raw message