HADOOP-7089. Fix link resolution logic in hadoop-config.sh. Contributed by Eli Collins
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1058881 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ebb7b7f088
commit
3d1b9ca1e3
|
@ -443,6 +443,8 @@ Release 0.22.0 - Unreleased
|
|||
HADOOP-7101. UserGroupInformation.getCurrentUser() fails when called from
|
||||
non-Hadoop JAAS context. (todd)
|
||||
|
||||
HADOOP-7089. Fix link resolution logic in hadoop-config.sh. (eli)
|
||||
|
||||
Release 0.21.1 - Unreleased
|
||||
|
||||
IMPROVEMENTS
|
||||
|
|
|
@ -17,23 +17,12 @@
|
|||
# should not be executable directly
|
||||
# also should not be passed any arguments, since we need original $*
|
||||
|
||||
# resolve links - $0 may be a softlink
|
||||
|
||||
# Resolve links ($0 may be a softlink) and convert a relative path
|
||||
# to an absolute path. NB: The -P option requires bash built-ins
|
||||
# or POSIX:2001 compliant cd and pwd.
|
||||
this="${BASH_SOURCE-$0}"
|
||||
while [ -h "$this" ]; do
|
||||
ls=`ls -ld "$this"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '.*/.*' > /dev/null; then
|
||||
this="$link"
|
||||
else
|
||||
this=`dirname "$this"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
# convert relative path to absolute path
|
||||
common_bin=`dirname "$this"`
|
||||
script=`basename "$this"`
|
||||
common_bin=`cd "$common_bin"; pwd`
|
||||
common_bin=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
|
||||
script="$(basename -- "$this")"
|
||||
this="$common_bin/$script"
|
||||
|
||||
# the root of the Hadoop installation
|
||||
|
|
Loading…
Reference in New Issue