From f8f275c1ad2bd1b931f6ca9101b5067979f505b8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 29 Apr 2010 23:23:53 +0000 Subject: [PATCH] HADOOP-6630. hadoop-config.sh fails to get executed if hadoop wrapper scripts are in path. Contributed by Allen Wittenauer. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@939510 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ bin/hadoop-config.sh | 2 +- bin/hadoop-daemon.sh | 2 +- bin/hadoop-daemons.sh | 2 +- bin/rcc | 2 +- bin/slaves.sh | 2 +- bin/start-all.sh | 2 +- bin/start-balancer.sh | 2 +- bin/start-dfs.sh | 2 +- bin/start-mapred.sh | 2 +- bin/stop-all.sh | 2 +- bin/stop-balancer.sh | 2 +- bin/stop-dfs.sh | 2 +- bin/stop-mapred.sh | 2 +- 14 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 576a7fb7c2f..25c67079b0c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -382,6 +382,9 @@ Trunk (unreleased changes) HADOOP-6709. Re-instate deprecated FileSystem methods that were removed after 0.20. (tomwhite) + HADOOP-6630. hadoop-config.sh fails to get executed if hadoop wrapper + scripts are in path. (Allen Wittenauer via tomwhite) + Release 0.21.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/bin/hadoop-config.sh b/bin/hadoop-config.sh index 9b798845b59..aabeffefcfc 100644 --- a/bin/hadoop-config.sh +++ b/bin/hadoop-config.sh @@ -19,7 +19,7 @@ # resolve links - $0 may be a softlink -this="$0" +this="${BASH_SOURCE-$0}" while [ -h "$this" ]; do ls=`ls -ld "$this"` link=`expr "$ls" : '.*-> \(.*\)$'` diff --git a/bin/hadoop-daemon.sh b/bin/hadoop-daemon.sh index a6d8d6a4b24..df2cbdaad52 100755 --- a/bin/hadoop-daemon.sh +++ b/bin/hadoop-daemon.sh @@ -36,7 +36,7 @@ if [ $# -le 1 ]; then exit 1 fi -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . "$bin"/hadoop-config.sh diff --git a/bin/hadoop-daemons.sh b/bin/hadoop-daemons.sh index 894d8ab11a5..5cabd39067d 100755 --- a/bin/hadoop-daemons.sh +++ b/bin/hadoop-daemons.sh @@ -26,7 +26,7 @@ if [ $# -le 1 ]; then exit 1 fi -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . $bin/hadoop-config.sh diff --git a/bin/rcc b/bin/rcc index a023da021f8..c16667193be 100755 --- a/bin/rcc +++ b/bin/rcc @@ -27,7 +27,7 @@ # HADOOP_CONF_DIR Alternate conf dir. Default is ${HADOOP_HOME}/conf. # -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . "$bin"/hadoop-config.sh diff --git a/bin/slaves.sh b/bin/slaves.sh index fc9f720be7e..bc6078a8cbc 100755 --- a/bin/slaves.sh +++ b/bin/slaves.sh @@ -35,7 +35,7 @@ if [ $# -le 0 ]; then exit 1 fi -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . "$bin"/hadoop-config.sh diff --git a/bin/start-all.sh b/bin/start-all.sh index 1c7dd87dea9..d4b8bec6d4e 100755 --- a/bin/start-all.sh +++ b/bin/start-all.sh @@ -20,7 +20,7 @@ echo "This script is Deprecated. Instead use start-dfs.sh and start-mapred.sh" -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . "$bin"/hadoop-config.sh diff --git a/bin/start-balancer.sh b/bin/start-balancer.sh index 8594be77220..da00ec1c0df 100755 --- a/bin/start-balancer.sh +++ b/bin/start-balancer.sh @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . "$bin"/hdfs-config.sh diff --git a/bin/start-dfs.sh b/bin/start-dfs.sh index 3ffcf4b9618..d5f7da8d4e0 100755 --- a/bin/start-dfs.sh +++ b/bin/start-dfs.sh @@ -22,7 +22,7 @@ usage="Usage: start-dfs.sh [-upgrade|-rollback]" -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . "$bin"/hdfs-config.sh diff --git a/bin/start-mapred.sh b/bin/start-mapred.sh index 4eccd3b110d..6dc55fe303d 100755 --- a/bin/start-mapred.sh +++ b/bin/start-mapred.sh @@ -18,7 +18,7 @@ # Start hadoop map reduce daemons. Run this on master node. -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . $bin/mapred-config.sh diff --git a/bin/stop-all.sh b/bin/stop-all.sh index ab0cd8f62a0..7c267f3403c 100755 --- a/bin/stop-all.sh +++ b/bin/stop-all.sh @@ -20,7 +20,7 @@ echo "This script is Deprecated. Instead use stop-dfs.sh and stop-mapred.sh" -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . "$bin"/hadoop-config.sh diff --git a/bin/stop-balancer.sh b/bin/stop-balancer.sh index f53649b6702..7b6326e2ba4 100755 --- a/bin/stop-balancer.sh +++ b/bin/stop-balancer.sh @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . "$bin"/hdfs-config.sh diff --git a/bin/stop-dfs.sh b/bin/stop-dfs.sh index 5d3fe54db98..6fc1f68bd49 100755 --- a/bin/stop-dfs.sh +++ b/bin/stop-dfs.sh @@ -18,7 +18,7 @@ # Stop hadoop DFS daemons. Run this on master node. -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . "$bin"/hdfs-config.sh diff --git a/bin/stop-mapred.sh b/bin/stop-mapred.sh index 1a65a3eaa8a..e611aedaf28 100755 --- a/bin/stop-mapred.sh +++ b/bin/stop-mapred.sh @@ -18,7 +18,7 @@ # Stop hadoop map reduce daemons. Run this on master node. -bin=`dirname "$0"` +bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin"; pwd` . $bin/mapred-config.sh