Skip to content

Commit 4cd0253

Browse files
committed
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.
1 parent c5200ba commit 4cd0253

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/compiler/scala/tools/ant/templates/tool-unix.tmpl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@
99
##############################################################################
1010

1111
findScalaHome () {
12-
# see #2092
12+
# see SI-2092
1313
local SOURCE="${BASH_SOURCE[0]}"
1414
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
15-
( cd -P "$( dirname "$SOURCE" )"/.. && pwd )
15+
local bindir="$( dirname "$SOURCE" )"
16+
if [[ -d "$bindir"/.. ]]; then
17+
( cd -P "$bindir"/.. && pwd )
18+
else
19+
# See SI-5792
20+
local dir=$(dirname "${BASH_SOURCE[0]}")
21+
local link=$(dirname "$(readlink "${BASH_SOURCE[0]}")")
22+
local path="$dir/$link/.."
23+
( cd "$path" && pwd )
24+
fi
1625
}
1726
execCommand () {
1827
[[ -n $SCALA_RUNNER_DEBUG ]] && echo "" && for arg in "$@@"; do echo "$arg"; done && echo "";

0 commit comments

Comments
 (0)