Bug 456719 run-mozilla.sh doesn't work well with ksh93 r=benjamin
authorGinn Chen <ginn.chen@sun.com>
Thu, 23 Jul 2009 18:09:10 +0800
changeset 30598 d783d91beec50e7f795615b5718b09f76c2f22ab
parent 30597 9efce50d28ca9153f80b1e232314f8826c9e0bed
child 30599 16120b84f2a351ab84143d6cd23d7a93af90af0d
push idunknown
push userunknown
push dateunknown
reviewersbenjamin
bugs456719
milestone1.9.2a1pre
Bug 456719 run-mozilla.sh doesn't work well with ksh93 r=benjamin
build/unix/mozilla.in
build/unix/run-mozilla.sh
--- a/build/unix/mozilla.in
+++ b/build/unix/mozilla.in
@@ -62,26 +62,28 @@ run_moz="$curdir/run-mozilla.sh"
 if test -x "$run_moz"; then
   dist_bin="$curdir"
   found=1
 else
   here=`/bin/pwd`
   while [ -h "$progname" ]; do
     bn=`basename "$progname"`
     cd `dirname "$progname"`
+    # Resolve symlink of dirname
+    cd `/bin/pwd`
     progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
     progbase=`basename "$progname"`
     if [ ! -x "$progname" ]; then
       break
     fi
     curdir=`dirname "$progname"`
     run_moz="$curdir/run-mozilla.sh"
     if [ -x "$run_moz" ]; then
       cd "$curdir"
-      dist_bin=`pwd`
+      dist_bin=`/bin/pwd`
       run_moz="$dist_bin/run-mozilla.sh"
       found=1
       break
     fi
   done
   cd "$here"
 fi
 if [ $found = 0 ]; then
--- a/build/unix/run-mozilla.sh
+++ b/build/unix/run-mozilla.sh
@@ -105,22 +105,22 @@ moz_test_binary()
 ##########################################################################
 moz_get_debugger()
 {
 	debuggers="ddd gdb dbx bdb"
 	debugger="notfound"
 	done="no"
 	for d in $debuggers
 	do
-		moz_test_binary /bin/type
+		moz_test_binary /bin/which
 		if [ $? -eq 1 ]
 		then
-			dpath=`LC_MESSAGES=C type ${d} | awk '{print $3;}' | sed -e 's/\.$//'`	
+			dpath=`which ${d}`	
 		else 	
-			dpath=`which ${d}`	
+			dpath=`LC_MESSAGES=C type ${d} | awk '{print $3;}' | sed -e 's/\.$//'`	
 		fi
 		if [ -x "$dpath" ]
 		then
 			debugger=$dpath
 			break
 		fi
 	done
 	echo $debugger
@@ -151,22 +151,22 @@ moz_debug_program()
 	## Make sure the program is executable
 	##
 	if [ ! -x "$prog" ]
 	then
 		moz_bail "Cannot execute $prog."
 	fi
 	if [ -n "$moz_debugger" ]
 	then
-		moz_test_binary /bin/type
+		moz_test_binary /bin/which
 		if [ $? -eq 1 ]
 		then	
-			debugger=`LC_MESSAGES=C type $moz_debugger | awk '{print $3;}' | sed -e 's/\.$//'` 
+			debugger=`which $moz_debugger` 
 		else
-			debugger=`which $moz_debugger` 
+			debugger=`LC_MESSAGES=C type $moz_debugger | awk '{print $3;}' | sed -e 's/\.$//'` 
 		fi	
 	else
 		debugger=`moz_get_debugger`
 	fi
     if [ -x "$debugger" ] 
     then
         tmpfile=`mktemp /tmp/mozargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; }
         trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15