aboutsummaryrefslogtreecommitdiffstats
path: root/testing/java-jtreg/jtdiff-symlink-patch.txt
blob: 313c970f1f121f01907457ee479a08f8870c2f4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- a/usr/share/java/jtreg/bin/jtdiff
+++ b/usr/share/java/jtreg/bin/jtdiff
@@ -37,6 +37,10 @@
 #
 # jtdiff also provides an Ant task for direct invocation from Ant.
 
+_prog=$0
+_link=`readlink $_prog`
+[ -n "$_link" ] && _prog=$_link
+
 # Determine jtdiff/JavaTest installation directory
 if [ -n "$JT_HOME" ]; then
     if [ ! -r $JT_HOME/lib/jtreg.jar ];then
@@ -48,11 +52,11 @@
     # - should work on most derivatives of Bourne shell, like ash, bash, ksh,
     #   sh, zsh, etc, including on Windows, MKS (ksh) and Cygwin (ash or bash)
     if type -p type 1>/dev/null 2>&1 && test -z "`type -p type`" ; then
-        myname=`type -p "$0"`
+        myname=`type -p "$_prog"`
     elif type type 1>/dev/null 2>&1 ; then
-        myname=`type "$0" | sed -e 's/^.* is a tracked alias for //' -e 's/^.* is //'`
+        myname=`type "$_prog" | sed -e 's/^.* is a tracked alias for //' -e 's/^.* is //'`
     elif whence whence 1>/dev/null 2>&1 ; then
-        myname=`whence "$0"`
+        myname=`whence "$_prog"`
     fi
     mydir=`dirname "$myname"`
     p=`cd "$mydir" ; pwd`
@@ -117,7 +121,7 @@
 
 "${JT_JAVA:-${JAVA_HOME:+$JAVA_HOME/bin/}java}" \
     $javaOpts \
-    -Dprogram=`basename "$0"` \
+    -Dprogram=`basename "$_prog"` \
     -cp "${JT_HOME}/lib/jtreg.jar" \
     com.sun.javatest.diff.Main \
     $jtdiffOpts