You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by na...@apache.org on 2018/03/19 19:09:21 UTC

[10/15] incubator-spot git commit: Add quotes around safe_dir arguments so that they are safely handled

Add quotes around safe_dir arguments so that they are safely handled

Without quotes, each argument passed in will get parsed in pieces if they have spaces.
(i.e. sudo -u hdfs hdfs dfs ---> $1=sudo and $2=-u when passed into safe_dir() )


Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/1bbb8087
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/1bbb8087
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/1bbb8087

Branch: refs/heads/SPOT-181_ODM
Commit: 1bbb80877112acbf46cc569fcb3a7c18f31ef3ee
Parents: 095695a
Author: Tadd Wood <ta...@arcadiadata.com>
Authored: Wed Feb 14 12:32:32 2018 -0800
Committer: Tadd Wood <ta...@arcadiadata.com>
Committed: Wed Feb 14 12:32:32 2018 -0800

----------------------------------------------------------------------
 spot-setup/odm/odm_setup.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/1bbb8087/spot-setup/odm/odm_setup.sh
----------------------------------------------------------------------
diff --git a/spot-setup/odm/odm_setup.sh b/spot-setup/odm/odm_setup.sh
index dd31d55..8de7f7e 100755
--- a/spot-setup/odm/odm_setup.sh
+++ b/spot-setup/odm/odm_setup.sh
@@ -44,8 +44,8 @@ function safe_mkdir() {
     # 1. Takes the hdfs command options and a directory
     # 2. Checks for the directory before trying to create it and keeps the script from creating existing directories
 
-    local hdfs_cmd=$1
-    local dir=$2
+    local hdfs_cmd="$1"
+    local dir="$2"
     if $(hdfs dfs -test -d ${dir}); then
         log "${dir} already exists"
     else
@@ -113,7 +113,7 @@ fi
 
 # Creating HDFS user's folder
 log "creating ${HUSER}"
-safe_mkdir ${hdfs_cmd} ${HUSER}
+safe_mkdir "${hdfs_cmd}" "${HUSER}"
 ${hdfs_cmd} dfs -chown ${USER}:supergroup ${HUSER}
 ${hdfs_cmd} dfs -chmod 775 ${HUSER}
 
@@ -121,18 +121,18 @@ ${hdfs_cmd} dfs -chmod 775 ${HUSER}
 for d in "${DSOURCES[@]}" 
 do 
 	log "creating /$d"
-	safe_mkdir hdfs ${HUSER}/$d
+	safe_mkdir "${hdfs_cmd}" "${HUSER}/$d"
     
     # Create Avro schemas directory on HDFS if Avro storage is selected
     if [ "$format" == "avro" ] ; then
         log "creating ${HUSER}/$d/schema"
-        safe_mkdir ${hdfs_cmd} ${HUSER}/$d/schema
+        safe_mkdir "${hdfs_cmd}" "${HUSER}/$d/schema"
     fi
 
 	for f in "${DFOLDERS[@]}" 
 	do 
 		log "creating ${HUSER}/$d/$f"
-		safe_mkdir ${hdfs_cmd} ${HUSER}/$d/$f
+		safe_mkdir "${hdfs_cmd}" "${HUSER}/$d/$f"
 	done
 
 	# Modifying permission on HDFS folders to allow Impala to read/write