zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cami...@apache.org
Subject svn commit: r1484355 - in /zookeeper/trunk: CHANGES.txt bin/zkCleanup.sh bin/zkCli.sh bin/zkEnv.sh bin/zkServer-initialize.sh bin/zkServer.sh
Date Sun, 19 May 2013 21:58:21 GMT
Author: camille
Date: Sun May 19 21:58:21 2013
New Revision: 1484355

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

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/bin/zkCleanup.sh
    zookeeper/trunk/bin/zkCli.sh
    zookeeper/trunk/bin/zkEnv.sh
    zookeeper/trunk/bin/zkServer-initialize.sh
    zookeeper/trunk/bin/zkServer.sh

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1484355&r1=1484354&r2=1484355&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Sun May 19 21:58:21 2013
@@ -354,6 +354,8 @@ BUGFIXES:
   from the Leader to the Follower. (Thawan, fpj 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/trunk/bin/zkCleanup.sh
URL: http://svn.apache.org/viewvc/zookeeper/trunk/bin/zkCleanup.sh?rev=1484355&r1=1484354&r2=1484355&view=diff
==============================================================================
--- zookeeper/trunk/bin/zkCleanup.sh (original)
+++ zookeeper/trunk/bin/zkCleanup.sh Sun May 19 21:58:21 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/trunk/bin/zkCli.sh
URL: http://svn.apache.org/viewvc/zookeeper/trunk/bin/zkCli.sh?rev=1484355&r1=1484354&r2=1484355&view=diff
==============================================================================
--- zookeeper/trunk/bin/zkCli.sh (original)
+++ zookeeper/trunk/bin/zkCli.sh Sun May 19 21:58:21 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/trunk/bin/zkEnv.sh
URL: http://svn.apache.org/viewvc/zookeeper/trunk/bin/zkEnv.sh?rev=1484355&r1=1484354&r2=1484355&view=diff
==============================================================================
--- zookeeper/trunk/bin/zkEnv.sh (original)
+++ zookeeper/trunk/bin/zkEnv.sh Sun May 19 21:58:21 2013
@@ -25,8 +25,8 @@
 # Or you can specify the ZOOCFGDIR using the
 # '--config' option in the command line.
 
-ZOOBINDIR=${ZOOBINDIR:-/usr/bin}
-ZOOKEEPER_PREFIX=${ZOOBINDIR}/..
+ZOOBINDIR="${ZOOBINDIR:-/usr/bin}"
+ZOOKEEPER_PREFIX="${ZOOBINDIR}/.."
 
 #check to see if the conf dir is given as an optional argument
 if [ $# -gt 1 ]
@@ -90,18 +90,19 @@ do
 done
 
 #make it work in the binary package
+#(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
+  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/trunk/bin/zkServer-initialize.sh
URL: http://svn.apache.org/viewvc/zookeeper/trunk/bin/zkServer-initialize.sh?rev=1484355&r1=1484354&r2=1484355&view=diff
==============================================================================
--- zookeeper/trunk/bin/zkServer-initialize.sh (original)
+++ zookeeper/trunk/bin/zkServer-initialize.sh Sun May 19 21:58:21 2013
@@ -23,8 +23,8 @@
 
 # use POSIX 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
@@ -67,8 +67,8 @@ initialize() {
         exit 1
     fi
 
-    ZOO_DATADIR=$(grep "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//')
-    ZOO_DATALOGDIR=$(grep "^[[:space:]]*dataLogDir" "$ZOOCFG" | sed -e 's/.*=//')
+    ZOO_DATADIR="$(grep "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//')"
+    ZOO_DATALOGDIR="$(grep "^[[:space:]]*dataLogDir" "$ZOOCFG" | sed -e 's/.*=//')"
 
     if [ -z "$ZOO_DATADIR" ]; then
         echo "Unable to determine dataDir from $ZOOCFG"

Modified: zookeeper/trunk/bin/zkServer.sh
URL: http://svn.apache.org/viewvc/zookeeper/trunk/bin/zkServer.sh?rev=1484355&r1=1484354&r2=1484355&view=diff
==============================================================================
--- zookeeper/trunk/bin/zkServer.sh (original)
+++ zookeeper/trunk/bin/zkServer.sh Sun May 19 21:58:21 2013
@@ -44,8 +44,8 @@ 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
@@ -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,8 +80,8 @@ fi
 
 echo "Using config: $ZOOCFG" >&2
 
-ZOO_DATADIR=$(grep "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//')
-ZOO_DATALOGDIR=$(grep "^[[:space:]]*dataLogDir" "$ZOOCFG" | sed -e 's/.*=//')
+ZOO_DATADIR="$(grep "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//')"
+ZOO_DATALOGDIR="$(grep "^[[:space:]]*dataLogDir" "$ZOOCFG" | sed -e 's/.*=//')"
 
 # iff autocreate is turned off and the datadirs don't exist fail
 # immediately as we can't create the PID file, etc..., anyway.
@@ -105,7 +105,7 @@ if [ -z "$ZOOPIDFILE" ]; then
     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
@@ -117,13 +117,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 $ZOO_DATADIR_AUTOCREATE "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" \
+    nohup "$JAVA" $ZOO_DATADIR_AUTOCREATE "-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 ]
@@ -142,16 +142,16 @@ 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 $ZOO_DATADIR_AUTOCREATE "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" \
+    "${ZOO_CMD[@]}" $ZOO_DATADIR_AUTOCREATE "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" \
     "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
     -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG"
     ;;
 print-cmd)
-    echo "$JAVA $ZOO_DATADIR_AUTOCREATE -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\" $ZOO_DATADIR_AUTOCREATE -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 ... "
@@ -187,7 +187,7 @@ status)
        fi
     fi
     echo "Client port found: $clientPort"
-    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
\
              $clientPort srvr 2> /dev/null    \
           | grep Mode`



Mime
View raw message