Sfoglia il codice sorgente

HADOOP-12116. Fix unrecommended syntax usages in hadoop/hdfs/yarn script for cygwin in branch-2. Contributed by Li Lu.

cnauroth 9 anni fa
parent
commit
f7ba3c0045

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -419,6 +419,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12159. Move DistCpUtils#compareFs() to org.apache.hadoop.fs.FileUtil
     and fix for HA namespaces (rchiang via rkanter)
 
+    HADOOP-12116. Fix unrecommended syntax usages in hadoop/hdfs/yarn script for
+    cygwin in branch-2. (Li Lu via cnauroth)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 2 - 2
hadoop-common-project/hadoop-common/src/main/bin/hadoop

@@ -128,7 +128,7 @@ case $COMMAND in
         CLASS=org.apache.hadoop.util.Classpath
       else
         # No need to bother starting up a JVM for this simple case.
-        if $cygwin; then
+        if [ "$cygwin" = true ]; then
           CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
         fi
         echo $CLASSPATH
@@ -143,7 +143,7 @@ case $COMMAND in
     fi
 
     # cygwin path translation
-    if $cygwin; then
+    if [ "$cygwin" = true ]; then
       CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
       HADOOP_LOG_DIR=$(cygpath -w "$HADOOP_LOG_DIR" 2>/dev/null)
       HADOOP_PREFIX=$(cygpath -w "$HADOOP_PREFIX" 2>/dev/null)

+ 2 - 2
hadoop-common-project/hadoop-common/src/main/bin/hadoop-config.sh

@@ -251,7 +251,7 @@ TOOL_PATH="${TOOL_PATH:-$HADOOP_PREFIX/share/hadoop/tools/lib/*}"
 HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.log.dir=$HADOOP_LOG_DIR"
 HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.log.file=$HADOOP_LOGFILE"
 HADOOP_HOME=$HADOOP_PREFIX
-if $cygwin; then
+if [ "$cygwin" = true ]; then
   HADOOP_HOME=$(cygpath -w "$HADOOP_HOME" 2>/dev/null)
 fi
 export HADOOP_HOME
@@ -259,7 +259,7 @@ HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.home.dir=$HADOOP_HOME"
 HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.id.str=$HADOOP_IDENT_STRING"
 HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.root.logger=${HADOOP_ROOT_LOGGER:-${HADOOP_LOGLEVEL},console}"
 if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
-  if $cygwin; then
+  if [ "$cygwin" = true ]; then
     JAVA_LIBRARY_PATH=$(cygpath -w "$JAVA_LIBRARY_PATH" 2>/dev/null)
   fi
   HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs

@@ -209,7 +209,7 @@ elif [ "$COMMAND" = "classpath" ]; then
     CLASS=org.apache.hadoop.util.Classpath
   else
     # No need to bother starting up a JVM for this simple case.
-    if $cygwin; then
+    if [ "$cygwin" = true ]; then
       CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
     fi
     echo $CLASSPATH
@@ -220,7 +220,7 @@ else
 fi
 
 # cygwin path translation
-if $cygwin; then
+if [ "$cygwin" = true ]; then
   CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
   HADOOP_LOG_DIR=$(cygpath -w "$HADOOP_LOG_DIR" 2>/dev/null)
   HADOOP_PREFIX=$(cygpath -w "$HADOOP_PREFIX" 2>/dev/null)

+ 2 - 2
hadoop-mapreduce-project/bin/mapred

@@ -146,7 +146,7 @@ if [ "$COMMAND" = "classpath" ] ; then
   if [ "$#" -gt 0 ]; then
     CLASS=org.apache.hadoop.util.Classpath
   else
-    if $cygwin; then
+    if [ "$cygwin" = true ]; then
       CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
     fi
     echo $CLASSPATH
@@ -155,7 +155,7 @@ if [ "$COMMAND" = "classpath" ] ; then
 fi
 
 # cygwin path translation
-if $cygwin; then
+if [ "$cygwin" = true ]; then
   CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
   HADOOP_LOG_DIR=$(cygpath -w "$HADOOP_LOG_DIR" 2>/dev/null)
   HADOOP_PREFIX=$(cygpath -w "$HADOOP_PREFIX" 2>/dev/null)

+ 4 - 4
hadoop-yarn-project/hadoop-yarn/bin/yarn

@@ -211,7 +211,7 @@ if [ "$COMMAND" = "classpath" ] ; then
   if [ "$#" -gt 0 ]; then
     CLASS=org.apache.hadoop.util.Classpath
   else
-    if $cygwin; then
+    if [ "$cygwin" = true ]; then
       CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
     fi
     echo $CLASSPATH
@@ -327,7 +327,7 @@ else
 fi
 
 # cygwin path translation
-if $cygwin; then
+if [ "$cygwin" = true ]; then
   CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
   HADOOP_LOG_DIR=$(cygpath -w "$HADOOP_LOG_DIR" 2>/dev/null)
   HADOOP_PREFIX=$(cygpath -w "$HADOOP_PREFIX" 2>/dev/null)
@@ -345,7 +345,7 @@ YARN_OPTS="$YARN_OPTS -Dhadoop.log.file=$YARN_LOGFILE"
 YARN_OPTS="$YARN_OPTS -Dyarn.log.file=$YARN_LOGFILE"
 YARN_OPTS="$YARN_OPTS -Dyarn.home.dir=$HADOOP_YARN_HOME"
 HADOOP_HOME=$HADOOP_PREFIX
-if $cygwin; then
+if [ "$cygwin" = true ]; then
   HADOOP_HOME=$(cygpath -w "$HADOOP_HOME" 2>/dev/null)
 fi
 export HADOOP_HOME
@@ -353,7 +353,7 @@ YARN_OPTS="$YARN_OPTS -Dhadoop.home.dir=$HADOOP_HOME"
 YARN_OPTS="$YARN_OPTS -Dhadoop.root.logger=${YARN_ROOT_LOGGER:-${HADOOP_LOGLEVEL},console}"
 YARN_OPTS="$YARN_OPTS -Dyarn.root.logger=${YARN_ROOT_LOGGER:-${HADOOP_LOGLEVEL},console}"
 if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
-  if $cygwin; then
+  if [ "$cygwin" = true ]; then
     JAVA_LIBRARY_PATH=$(cygpath -w "$JAVA_LIBRARY_PATH" 2>/dev/null)
   fi
   YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"