aboutsummaryrefslogtreecommitdiff
path: root/runtest
diff options
context:
space:
mode:
authorJacob Bachmeyer <jcb@gnu.org>2021-03-25 23:35:53 -0500
committerJacob Bachmeyer <jcb@gnu.org>2021-03-25 23:35:53 -0500
commite3b14d8555c5cabad03b9ccaa6aa1976ed590201 (patch)
treedaaae93a7692cec562740ea6163f78212a01ee07 /runtest
parentdcf155087a1311d9d90da3c12ce81935b3f926cc (diff)
downloaddejagnu-e3b14d8555c5cabad03b9ccaa6aa1976ed590201.zip
dejagnu-e3b14d8555c5cabad03b9ccaa6aa1976ed590201.tar.gz
dejagnu-e3b14d8555c5cabad03b9ccaa6aa1976ed590201.tar.bz2
Use older shell constructs to fix PR47382
The Solaris 10 /bin/sh does not support POSIX command or arithmetic substitutions. This commit reverts to using the old style backtick form and the expr command for arithmetic.
Diffstat (limited to 'runtest')
-rwxr-xr-xruntest32
1 files changed, 24 insertions, 8 deletions
diff --git a/runtest b/runtest
index ee6880c..b2e0a4c 100755
--- a/runtest
+++ b/runtest
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 1992-2016 Free Software Foundation, Inc.
+# Copyright (C) 1992-2016, 2021 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
@@ -21,6 +21,18 @@
# This script was written by Rob Savoye. The script finds the proper
# expect shell and then starts DejaGnu.
+# shellcheck disable=SC2003
+# The shellcheck tool complains about use of expr and recommends using
+# newer shell features instead. Solaris 10 /bin/sh does not support the
+# newer features, so we must use expr in this script.
+
+# shellcheck disable=SC2006
+# The shellcheck tool complains about the old style backtick command
+# substitution. Solaris 10 /bin/sh does not support the new style $()
+# command substitution and the usage of command substitution in this script
+# is simple enough to work. Most notably, nesting backtick command
+# substitution is tricky, but we do not do that.
+
# Get the execution path to this script and the current directory.
mypath=${0-.}
@@ -40,13 +52,13 @@ else
done
IFS="$save_ifs"
fi
-execpath=$(echo "$mypath" | sed -e 's@/[^/]*$@@')
+execpath=`echo "$mypath" | sed -e 's@/[^/]*$@@'`
# Get the name by which runtest was invoked and extract the config
# triplet.
-runtest=$(echo "$mypath" | sed -e 's@^.*/@@')
-target=$(echo "$runtest" | sed -e 's/-runtest$//')
+runtest=`echo "$mypath" | sed -e 's@^.*/@@'`
+target=`echo "$runtest" | sed -e 's/-runtest$//'`
if [ "$target" != runtest ] ; then
target="--target ${target}"
else
@@ -86,7 +98,7 @@ verbose=0
debug=""
for a in "$@" ; do
case $a in
- -v|--v|-verb*|--verb*) verbose=$((verbose + 1)) ;;
+ -v|--v|-verb*|--verb*) verbose=`expr $verbose + 1` ;;
-D0|--D0) debug="-D 0" ;;
-D1|--D1) debug="-D 1" ;;
esac
@@ -108,10 +120,11 @@ fi
#
# .. which is a very weak assumption
+bindir1up_check=`echo "$execpath" | sed -e 's@/[^/]*$@/share/dejagnu@'`
+bindir2up_check=`echo "$execpath" | sed -e 's@/[^/]*/[^/]*$@/share/dejagnu@'`
+
for i in \
- $(echo "$execpath" | sed -e 's@/[^/]*$@/share/dejagnu@') \
- $(echo "$execpath" | sed -e 's@/[^/]*/[^/]*$@/share/dejagnu@') \
- "$execpath" \
+ "${bindir1up_check}" "${bindir2up_check}" "$execpath" \
/usr/share/dejagnu \
/usr/local/share/dejagnu ; do
if expr "$verbose" \> 1 > /dev/null ; then
@@ -144,4 +157,7 @@ if ! command -v "$expectbin" > /dev/null ; then
exit 1
fi
+# The `debug' and `target' variables are _intended_ to contain zero or two
+# words each. Word splitting is desired here.
+# shellcheck disable=SC2086
exec "$expectbin" $debug -- "$runpath"/runtest.exp $target ${1+"$@"}