cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eev...@apache.org
Subject git commit: scripts fail when paths contain whitespace
Date Mon, 08 Jul 2013 19:32:55 GMT
Updated Branches:
  refs/heads/cassandra-1.2 f8c072e97 -> 909b2ed1a


scripts fail when paths contain whitespace

Patch by Amichai Rothman; Reviewed by eevans for CASSANDRA-5338


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/909b2ed1
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/909b2ed1
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/909b2ed1

Branch: refs/heads/cassandra-1.2
Commit: 909b2ed1a939048cd372bbf97918f0a69f80af92
Parents: f8c072e
Author: Eric Evans <eevans@apache.org>
Authored: Mon Jul 8 14:20:40 2013 -0500
Committer: Eric Evans <eevans@apache.org>
Committed: Mon Jul 8 14:20:40 2013 -0500

----------------------------------------------------------------------
 bin/cassandra         | 10 +++++-----
 bin/cassandra-cli     | 20 ++++++++++----------
 bin/cassandra-shuffle | 24 ++++++++++++------------
 bin/cassandra.in.sh   | 16 ++++++++--------
 bin/debug-cql         |  4 ++--
 bin/json2sstable      | 20 ++++++++++----------
 bin/nodetool          | 30 +++++++++++++++---------------
 bin/sstable2json      | 20 ++++++++++----------
 bin/sstablekeys       | 22 +++++++++++-----------
 bin/sstableloader     | 20 ++++++++++----------
 bin/sstablescrub      | 20 ++++++++++----------
 11 files changed, 103 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/cassandra
----------------------------------------------------------------------
diff --git a/bin/cassandra b/bin/cassandra
index 25498aa..1fbf047 100755
--- a/bin/cassandra
+++ b/bin/cassandra
@@ -71,7 +71,7 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
                    "$HOME/.cassandra.in.sh" \
-                   "`dirname $0`/cassandra.in.sh"; do
+                   "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
             break
@@ -120,10 +120,10 @@ esac
 
 launch_service()
 {
-    pidpath=$1
-    foreground=$2
-    props=$3
-    class=$4
+    pidpath="$1"
+    foreground="$2"
+    props="$3"
+    class="$4"
     cassandra_parms="-Dlog4j.configuration=log4j-server.properties -Dlog4j.defaultInitOverride=true"
 
     if [ "x$pidpath" != "x" ]; then

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/cassandra-cli
----------------------------------------------------------------------
diff --git a/bin/cassandra-cli b/bin/cassandra-cli
index c5fe27b..56c3095 100755
--- a/bin/cassandra-cli
+++ b/bin/cassandra-cli
@@ -21,29 +21,29 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
                    ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    JAVA="`which java`"
 fi
 
-if [ -z $CLASSPATH ]; then
+if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
 
-$JAVA -ea -cp $CLASSPATH -Xmx256M \
+"$JAVA" -ea -cp "$CLASSPATH" -Xmx256M \
         -Dlog4j.configuration=log4j-tools.properties \
         org.apache.cassandra.cli.CliMain "$@"
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/cassandra-shuffle
----------------------------------------------------------------------
diff --git a/bin/cassandra-shuffle b/bin/cassandra-shuffle
index d6dabfe..53636f7 100755
--- a/bin/cassandra-shuffle
+++ b/bin/cassandra-shuffle
@@ -19,24 +19,24 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
     for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    JAVA="`which java`"
 fi
 
-if [ -z $CASSANDRA_CONF -o -z $CLASSPATH ]; then
+if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
     echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
     exit 1
 fi
@@ -44,12 +44,12 @@ fi
 # Special-case path variables.
 case "`uname`" in
     CYGWIN*) 
-        CLASSPATH=`cygpath -p -w "$CLASSPATH"`
-        CASSANDRA_CONF=`cygpath -p -w "$CASSANDRA_CONF"`
+        CLASSPATH="`cygpath -p -w "$CLASSPATH"`"
+        CASSANDRA_CONF="`cygpath -p -w "$CASSANDRA_CONF"`"
     ;;
 esac
 
-$JAVA -cp $CLASSPATH \
+"$JAVA" -cp "$CLASSPATH" \
       -Xmx32m \
       -Dlog4j.configuration=log4j-tools.properties \
       org.apache.cassandra.tools.Shuffle $@

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/cassandra.in.sh
----------------------------------------------------------------------
diff --git a/bin/cassandra.in.sh b/bin/cassandra.in.sh
index 464cc37..2d5a932 100644
--- a/bin/cassandra.in.sh
+++ b/bin/cassandra.in.sh
@@ -15,27 +15,27 @@
 # limitations under the License.
 
 if [ "x$CASSANDRA_HOME" = "x" ]; then
-    CASSANDRA_HOME=`dirname $0`/..
+    CASSANDRA_HOME="`dirname "$0"`/.."
 fi
 
 # The directory where Cassandra's configs live (required)
 if [ "x$CASSANDRA_CONF" = "x" ]; then
-    CASSANDRA_CONF=$CASSANDRA_HOME/conf
+    CASSANDRA_CONF="$CASSANDRA_HOME/conf"
 fi
 
 # This can be the path to a jar file, or a directory containing the 
 # compiled classes. NOTE: This isn't needed by the startup script,
 # it's just used here in constructing the classpath.
-cassandra_bin=$CASSANDRA_HOME/build/classes/main
-cassandra_bin=$cassandra_bin:$CASSANDRA_HOME/build/classes/thrift
-#cassandra_bin=$cassandra_home/build/cassandra.jar
+cassandra_bin="$CASSANDRA_HOME/build/classes/main"
+cassandra_bin="$cassandra_bin:$CASSANDRA_HOME/build/classes/thrift"
+#cassandra_bin="$cassandra_home/build/cassandra.jar"
 
 # JAVA_HOME can optionally be set here
 #JAVA_HOME=/usr/local/jdk6
 
 # The java classpath (required)
-CLASSPATH=$CASSANDRA_CONF:$cassandra_bin
+CLASSPATH="$CASSANDRA_CONF:$cassandra_bin"
 
-for jar in $CASSANDRA_HOME/lib/*.jar; do
-    CLASSPATH=$CLASSPATH:$jar
+for jar in "$CASSANDRA_HOME"/lib/*.jar; do
+    CLASSPATH="$CLASSPATH:$jar"
 done

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/debug-cql
----------------------------------------------------------------------
diff --git a/bin/debug-cql b/bin/debug-cql
index f768cdd..aa6630f 100755
--- a/bin/debug-cql
+++ b/bin/debug-cql
@@ -51,8 +51,8 @@ fi
 # Special-case path variables.
 case "`uname`" in
     CYGWIN*) 
-        CLASSPATH=`cygpath -p -w "$CLASSPATH"`
-        CASSANDRA_CONF=`cygpath -p -w "$CASSANDRA_CONF"`
+        CLASSPATH="`cygpath -p -w "$CLASSPATH"`"
+        CASSANDRA_CONF="`cygpath -p -w "$CASSANDRA_CONF"`"
     ;;
 esac
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/json2sstable
----------------------------------------------------------------------
diff --git a/bin/json2sstable b/bin/json2sstable
index 02ebaaf..f41afd3 100755
--- a/bin/json2sstable
+++ b/bin/json2sstable
@@ -21,29 +21,29 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
                    ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    JAVA="`which java`"
 fi
 
-if [ -z $CLASSPATH ]; then
+if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
 
-$JAVA -cp $CLASSPATH  -Dstorage-config=$CASSANDRA_CONF \
+"$JAVA" -cp "$CLASSPATH" -Dstorage-config="$CASSANDRA_CONF" \
         -Dlog4j.configuration=log4j-tools.properties \
         org.apache.cassandra.tools.SSTableImport "$@"
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/nodetool
----------------------------------------------------------------------
diff --git a/bin/nodetool b/bin/nodetool
index 6678942..c602530 100755
--- a/bin/nodetool
+++ b/bin/nodetool
@@ -15,9 +15,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-if [ `basename $0` = 'nodeprobe' ]; then
+if [ "`basename "$0"`" = 'nodeprobe' ]; then
     echo "***************************************************************" >&2
-    echo "WARNING: $0 is obsolete, use `dirname $0`/nodetool instead" >&2
+    echo "WARNING: $0 is obsolete, use `dirname "$0"`/nodetool instead" >&2
     echo "***************************************************************" >&2
 fi
 
@@ -25,24 +25,24 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
     for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    JAVA="`which java`"
 fi
 
-if [ -z $CASSANDRA_CONF -o -z $CLASSPATH ]; then
+if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
     echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
     exit 1
 fi
@@ -50,15 +50,15 @@ fi
 # Special-case path variables.
 case "`uname`" in
     CYGWIN*) 
-        CLASSPATH=`cygpath -p -w "$CLASSPATH"`
-        CASSANDRA_CONF=`cygpath -p -w "$CASSANDRA_CONF"`
+        CLASSPATH="`cygpath -p -w "$CLASSPATH"`"
+        CASSANDRA_CONF="`cygpath -p -w "$CASSANDRA_CONF"`"
     ;;
 esac
 
-$JAVA -cp $CLASSPATH \
+"$JAVA" -cp "$CLASSPATH" \
       -Xmx32m \
       -Dlog4j.configuration=log4j-tools.properties \
-      -Dstorage-config=$CASSANDRA_CONF \
+      -Dstorage-config="$CASSANDRA_CONF" \
       org.apache.cassandra.tools.NodeCmd $@
 
 # vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/sstable2json
----------------------------------------------------------------------
diff --git a/bin/sstable2json b/bin/sstable2json
index dca2bd6..9b116ce 100755
--- a/bin/sstable2json
+++ b/bin/sstable2json
@@ -21,30 +21,30 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
                    ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    JAVA="`which java`"
 fi
 
-if [ -z $CLASSPATH ]; then
+if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
 
-$JAVA -cp $CLASSPATH  -Dstorage-config=$CASSANDRA_CONF \
+"$JAVA" -cp "$CLASSPATH" -Dstorage-config="$CASSANDRA_CONF" \
         -Dlog4j.configuration=log4j-tools.properties \
         org.apache.cassandra.tools.SSTableExport "$@"
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/sstablekeys
----------------------------------------------------------------------
diff --git a/bin/sstablekeys b/bin/sstablekeys
index 4c87bb5..81cffd0 100755
--- a/bin/sstablekeys
+++ b/bin/sstablekeys
@@ -21,34 +21,34 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
                    ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    JAVA="`which java`"
 fi
 
-if [ -z $CLASSPATH ]; then
+if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
 if [ $# -eq "0" ]; then
-    echo "Usage: `basename $0` <sstable>"
+    echo "Usage: `basename "$0"` <sstable>"
     exit 2
 fi
 
-$JAVA -cp $CLASSPATH  -Dstorage-config=$CASSANDRA_CONF \
+"$JAVA" -cp "$CLASSPATH" -Dstorage-config="$CASSANDRA_CONF" \
         -Dlog4j.configuration=log4j-tools.properties \
         org.apache.cassandra.tools.SSTableExport "$@" -e
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/sstableloader
----------------------------------------------------------------------
diff --git a/bin/sstableloader b/bin/sstableloader
index 2c82aa9..7696e10 100755
--- a/bin/sstableloader
+++ b/bin/sstableloader
@@ -21,29 +21,29 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
                    ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    JAVA="`which java`"
 fi
 
-if [ -z $CLASSPATH ]; then
+if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
 
-$JAVA -ea -cp $CLASSPATH -Xmx256M \
+"$JAVA" -ea -cp "$CLASSPATH" -Xmx256M \
         -Dlog4j.configuration=log4j-tools.properties \
         org.apache.cassandra.tools.BulkLoader "$@"
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/909b2ed1/bin/sstablescrub
----------------------------------------------------------------------
diff --git a/bin/sstablescrub b/bin/sstablescrub
index fdf23a5..1266ea7 100755
--- a/bin/sstablescrub
+++ b/bin/sstablescrub
@@ -21,24 +21,24 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
                    ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    JAVA="`which java`"
 fi
 
-if [ -z $CLASSPATH ]; then
+if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
@@ -47,7 +47,7 @@ if [ "x$MAX_HEAP_SIZE" = "x" ]; then
     MAX_HEAP_SIZE="256M"
 fi
 
-$JAVA -ea -cp $CLASSPATH -Xmx$MAX_HEAP_SIZE \
+"$JAVA" -ea -cp "$CLASSPATH" -Xmx$MAX_HEAP_SIZE \
         -Dlog4j.configuration=log4j-tools.properties \
         org.apache.cassandra.tools.StandaloneScrubber "$@"
 


Mime
View raw message