From a1618a2a77ef241b23058809037f93ea00da9329 Mon Sep 17 00:00:00 2001 From: Allen Wittenauer Date: Tue, 26 Aug 2014 14:40:46 -0700 Subject: [PATCH] HADOOP-11002. shell escapes are incompatible with previous releases (aw) --- .../hadoop-common/CHANGES.txt | 2 ++ .../src/main/bin/hadoop-functions.sh | 31 ++++++------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 9242ca4124..2270df3424 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -319,6 +319,8 @@ Trunk (Unreleased) HADOOP-10925. Compilation fails in native link0 function on Windows. (cnauroth) + HADOOP-11002. shell escapes are incompatible with previous releases (aw) + OPTIMIZATIONS HADOOP-7761. Improve the performance of raw comparisons. (todd) diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh index f2437fa2ff..ab61b8483f 100644 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh @@ -59,8 +59,7 @@ function hadoop_bootstrap_init TOOL_PATH=${TOOL_PATH:-${HADOOP_PREFIX}/share/hadoop/tools/lib/*} export HADOOP_OS_TYPE=${HADOOP_OS_TYPE:-$(uname -s)} - - + # defaults export HADOOP_OPTS=${HADOOP_OPTS:-"-Djava.net.preferIPv4Stack=true"} } @@ -94,7 +93,6 @@ function hadoop_exec_hadoopenv fi } - function hadoop_basic_init { # Some of these are also set in hadoop-env.sh. @@ -446,7 +444,6 @@ function hadoop_add_to_classpath_mapred hadoop_add_classpath "${HADOOP_MAPRED_HOME}/${MAPRED_DIR}"'/*' } - function hadoop_add_to_classpath_userpath { # Add the user-specified HADOOP_CLASSPATH to the @@ -551,7 +548,6 @@ function hadoop_java_setup fi } - function hadoop_finalize_libpaths { if [[ -n "${JAVA_LIBRARY_PATH}" ]]; then @@ -564,17 +560,14 @@ function hadoop_finalize_libpaths # # fill in any last minute options that might not have been defined yet # -# Note that we are replacing ' ' with '\ ' so that directories with -# spaces work correctly when run exec blah -# function hadoop_finalize_hadoop_opts { - hadoop_add_param HADOOP_OPTS hadoop.log.dir "-Dhadoop.log.dir=${HADOOP_LOG_DIR/ /\ }" - hadoop_add_param HADOOP_OPTS hadoop.log.file "-Dhadoop.log.file=${HADOOP_LOGFILE/ /\ }" - hadoop_add_param HADOOP_OPTS hadoop.home.dir "-Dhadoop.home.dir=${HADOOP_PREFIX/ /\ }" - hadoop_add_param HADOOP_OPTS hadoop.id.str "-Dhadoop.id.str=${HADOOP_IDENT_STRING/ /\ }" + hadoop_add_param HADOOP_OPTS hadoop.log.dir "-Dhadoop.log.dir=${HADOOP_LOG_DIR}" + hadoop_add_param HADOOP_OPTS hadoop.log.file "-Dhadoop.log.file=${HADOOP_LOGFILE}" + hadoop_add_param HADOOP_OPTS hadoop.home.dir "-Dhadoop.home.dir=${HADOOP_PREFIX}" + hadoop_add_param HADOOP_OPTS hadoop.id.str "-Dhadoop.id.str=${HADOOP_IDENT_STRING}" hadoop_add_param HADOOP_OPTS hadoop.root.logger "-Dhadoop.root.logger=${HADOOP_ROOT_LOGGER}" - hadoop_add_param HADOOP_OPTS hadoop.policy.file "-Dhadoop.policy.file=${HADOOP_POLICYFILE/ /\ }" + hadoop_add_param HADOOP_OPTS hadoop.policy.file "-Dhadoop.policy.file=${HADOOP_POLICYFILE}" hadoop_add_param HADOOP_OPTS hadoop.security.logger "-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER}" } @@ -724,10 +717,8 @@ function hadoop_java_exec local command=$1 local class=$2 shift 2 - # we eval this so that paths with spaces work #shellcheck disable=SC2086 - eval exec "$JAVA" "-Dproc_${command}" ${HADOOP_OPTS} "${class}" "$@" - + exec "${JAVA}" "-Dproc_${command}" ${HADOOP_OPTS} "${class}" "$@" } function hadoop_start_daemon @@ -739,7 +730,7 @@ function hadoop_start_daemon local class=$2 shift 2 #shellcheck disable=SC2086 - eval exec "$JAVA" "-Dproc_${command}" ${HADOOP_OPTS} "${class}" "$@" + exec "${JAVA}" "-Dproc_${command}" ${HADOOP_OPTS} "${class}" "$@" } function hadoop_start_daemon_wrapper @@ -802,9 +793,7 @@ function hadoop_start_secure_daemon # where to send stderr. same thing, except &2 = stderr local daemonerrfile=$5 shift 5 - - - + hadoop_rotate_log "${daemonoutfile}" hadoop_rotate_log "${daemonerrfile}" @@ -925,7 +914,6 @@ function hadoop_stop_daemon fi } - function hadoop_stop_secure_daemon { local command=$1 @@ -984,7 +972,6 @@ function hadoop_daemon_handler esac } - function hadoop_secure_daemon_handler { local daemonmode=$1