From 4cd0253d0d461d01672334d240bc5249027f536b Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sun, 13 May 2012 01:11:39 -0700 Subject: Tweak to the runner to deal with the big bad world. Relative symlinks which start with .. are then run with an absolute path. It's robustness city. --- src/compiler/scala/tools/ant/templates/tool-unix.tmpl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl index 599936f6f8..85bb5f2056 100644 --- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl @@ -9,10 +9,19 @@ ############################################################################## findScalaHome () { - # see #2092 + # see SI-2092 local SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done - ( cd -P "$( dirname "$SOURCE" )"/.. && pwd ) + local bindir="$( dirname "$SOURCE" )" + if [[ -d "$bindir"/.. ]]; then + ( cd -P "$bindir"/.. && pwd ) + else + # See SI-5792 + local dir=$(dirname "${BASH_SOURCE[0]}") + local link=$(dirname "$(readlink "${BASH_SOURCE[0]}")") + local path="$dir/$link/.." + ( cd "$path" && pwd ) + fi } execCommand () { [[ -n $SCALA_RUNNER_DEBUG ]] && echo "" && for arg in "$@@"; do echo "$arg"; done && echo ""; -- cgit v1.2.3