Browse Source

HADOOP-1080. Fix classpath bug in bin/hadoop on Windows when native libraries are present. Contributed by Andrzej.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@515859 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 years ago
parent
commit
bf8d4596f1
2 changed files with 28 additions and 14 deletions
  1. 3 0
      CHANGES.txt
  2. 25 14
      bin/hadoop

+ 3 - 0
CHANGES.txt

@@ -30,6 +30,9 @@ Trunk (unreleased changes)
  8. HADOOP-1088.  Fix record serialization of negative values.
     (Milind Bhandarkar via cutting)
 
+ 9. HADOOP-1080.  Fix bug in bin/hadoop on Windows when native
+    libraries are present.  (ab via cutting)
+
 
 Release 0.12.0 - 2007-03-02
 

+ 25 - 14
bin/hadoop

@@ -21,6 +21,11 @@ bin=`cd "$bin"; pwd`
 
 . "$bin"/hadoop-config.sh
 
+cygwin=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+esac
+
 # if no args specified, show usage
 if [ $# = 0 ]; then
   echo "Usage: hadoop [--config confdir] COMMAND"
@@ -108,6 +113,21 @@ for f in $HADOOP_HOME/lib/jetty-ext/*.jar; do
   CLASSPATH=${CLASSPATH}:$f;
 done
 
+
+# default log directory & file
+if [ "$HADOOP_LOG_DIR" = "" ]; then
+  HADOOP_LOG_DIR="$HADOOP_HOME/logs"
+fi
+if [ "$HADOOP_LOGFILE" = "" ]; then
+  HADOOP_LOGFILE='hadoop.log'
+fi
+
+# cygwin path translation
+if $cygwin; then
+  CLASSPATH=`cygpath -p -w "$CLASSPATH"`
+  HADOOP_HOME=`cygpath -d "$HADOOP_HOME"`
+  HADOOP_LOG_DIR=`cygpath -d "$HADOOP_LOG_DIR"`
+fi
 # setup 'java.library.path' for native-hadoop code if necessary
 JAVA_LIBRARY_PATH=''
 if [ -d "${HADOOP_HOME}/build/native" -o -d "${HADOOP_HOME}/lib/native" ]; then
@@ -125,18 +145,15 @@ if [ -d "${HADOOP_HOME}/build/native" -o -d "${HADOOP_HOME}/lib/native" ]; then
     fi
   fi
 fi
+
+# cygwin path translation
+if $cygwin; then
+  JAVA_LIBRARY_PATH=`cygpath -p "$JAVA_LIBRARY_PATH"`
+fi
  
 # restore ordinary behaviour
 unset IFS
 
-# default log directory & file
-if [ "$HADOOP_LOG_DIR" = "" ]; then
-  HADOOP_LOG_DIR="$HADOOP_HOME/logs"
-fi
-if [ "$HADOOP_LOGFILE" = "" ]; then
-  HADOOP_LOGFILE='hadoop.log'
-fi
-
 # figure out which class to run
 if [ "$COMMAND" = "namenode" ] ; then
   CLASS='org.apache.hadoop.dfs.NameNode'
@@ -168,12 +185,6 @@ else
   CLASS=$COMMAND
 fi
 
-# cygwin path translation
-if expr `uname` : 'CYGWIN*' > /dev/null; then
-  CLASSPATH=`cygpath -p -w "$CLASSPATH"`
-  HADOOP_HOME=`cygpath -d "$HADOOP_HOME"`
-  HADOOP_LOG_DIR=`cygpath -d "$HADOOP_LOG_DIR"`
-fi
 
 HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.log.dir=$HADOOP_LOG_DIR"
 HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.log.file=$HADOOP_LOGFILE"