GNU bug report logs -
#47382
runtest doesn't work with Solaris 10 /bin/sh
Previous Next
Full log
Message #55 received at 47382 <at> debbugs.gnu.org (full text, mbox):
I have had time to address the rest of these:
Rainer Orth wrote:
> One can use \{0,1\} instead, but I cannot tell for certain how portable
> that is:
>
> diff --git a/dejagnu b/dejagnu
> --- a/dejagnu
> +++ b/dejagnu
> @@ -147,7 +147,7 @@ if $want_version ; then
> fi
>
> # Remove any leading autoconf platform prefix and the "dejagnu" prefix.
> -command=`basename "$0" | sed -e 's/^.*-\?dejagnu-\?//'`
> +command=`basename "$0" | sed -e 's/^.*-\{0,1\}dejagnu-\{0,1\}//'`
>
> while expr $# \> 0 > /dev/null
> do
>
Fixed in commit cc4d2e41f5d72be55e2b506f45fa052e1b3d410b; according to
the latest Autoconf manual, basename is not portable either!
8<----
diff --git a/dejagnu b/dejagnu
index ece4e09..c38dd4d 100755
--- a/dejagnu
+++ b/dejagnu
@@ -147,7 +147,20 @@ if $want_version ; then
fi
# Remove any leading autoconf platform prefix and the "dejagnu" prefix.
-command=`basename "$0" | sed -e 's/^.*-\?dejagnu-\?//'`
+# command=`basename "$0" | sed -e 's/^.*-\?dejagnu-\?//'`
+# The above simple solution is not portable, so we use Awk:
+command=`echo "$0" | awk 'BEGIN { FS = "/" }
+{ OFS = FS = "-"
+ $0 = $NF
+ for (i = 1; i <= NF; i++) if ($i ~ /dejagnu/) break;
+ for (j = 1; j <= (NF - i); j++) $j = $(j+i);
+ NF = j - 1
+ print }'`
+# Initially splitting on "/", then assigning the last field to the record
+# performs the role of basename. Splitting on "-" and searching for a
+# field matching /dejagnu/ identifies the other prefixes, and the second
+# loop removes the "dejagnu" prefix and everything before it. The record
+# is then truncated, printed, and thereby returned to the shell.
while expr $# \> 0 > /dev/null
do
8<----
> With that fixed I ran into:
>
> Found subcommand foo with variants: tcl sh
> grep: illegal option -- q
> Usage: grep -hblcnsviw pattern file . . .
> Selected variant tcl
>
> grep -q isn't portable, too, also documented in the Autoconf manual:
>
> Some of the options required by Posix are not portable in practice.
> Don't use @samp{grep -q} to suppress output, because traditional @command{grep}
> implementations (e.g., Solaris) do not support @option{-q}.
>
Fixed in commits 84c903914b49e5051f116b7a1512ee6d962d71bc (first) and
e2fa0bcf54e2bb05106be1ce22a73de4f7381444 (second). Splitting this also
allowed for neatly cleaning up the rest of the help display code in the
second commit.
8<----
diff --git a/dejagnu b/dejagnu
index c38dd4d..57767b1 100755
--- a/dejagnu
+++ b/dejagnu
@@ -248,11 +248,10 @@ if $have_gawk ; then
fi
# is "awk" actually GNU Awk?
if $have_awk ; then
- if "$awkbin" --version | sed 1q | grep -qi 'GNU Awk' ; then
- have_gawk_as_awk=true
- else
- have_gawk_as_awk=false
- fi
+ case `"$awkbin" --version 2>&1 | sed 1q` in
+ *'GNU Awk'*) have_gawk_as_awk=true ;;
+ *) have_gawk_as_awk=false ;;
+ esac
fi
if expr "$verbose" \> 2 > /dev/null ; then
if $have_awk ; then
8<----
8<----
diff --git a/dejagnu b/dejagnu
index 57767b1..d323a62 100755
--- a/dejagnu
+++ b/dejagnu
@@ -418,21 +418,15 @@ if $want_help ; then
echo ERROR: file "'$help_file'" is not readable
exit 2
fi
- if grep -q '#help' "$help_file" \
- && grep -q '#end' "$help_file"; then : ; else
+ if awk '/#help$/ { pfxlen = length($0) - 4 }
+ pfxlen && substr($0, pfxlen) == "#end" { exit 1 }
+ ' "$help_file" ; then
echo ERROR: file "'$help_file'" does not contain a help message
exit 2
fi
- help_prefix_pat=`grep '#help' "$help_file" \
- | sed -e 's/#help.*$//' -e '1q' | tr '[:print:][:blank:]' .`
- if expr "$verbose" \> 1 > /dev/null ; then
- echo Extracting help from "'$help_file'" with prefix "'$help_prefix_pat'
- fi
- sed -n < "$help_file" \
- -e '1,/#help/d' \
- -e '/^'"$help_prefix_pat"'#end/q' \
- -e 's/^'"$help_prefix_pat"'//;p'
- exit 0
+ exec awk '/#help$/ { pfxlen = length($0) - 4 }
+ pfxlen && substr($0, pfxlen) == "#end" { exit 0 }
+ pfxlen { print substr($0, pfxlen) }' "$help_file"
fi
if test -z "$command" ; then
8<----
> Now I'm down to
>
> Running /vol/src/gnu/dejagnu/dejagnu-1.6.3-branch/local/testsuite/launcher.all/command.exp ...
> FAIL: dejagnu --help works
> FAIL: dejagnu foo --help works if shell variant selected
>
> This only occurs when running runtest --tool launcher manually, but
> works with make check.
>
Please try the revised help support above; I suspect that there may have
been other issues. Working with make check but not directly invoked
runtest is ... strange.
-- Jacob
This bug report was last modified 3 years and 352 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.