Subject: Re: bug#47382: runtest doesn't work with Solaris 10 /bin/sh (oops, forgot patch...)

From: Jacob Bachmeyer <[email-masked]>
Date: Fri, 16 Apr 2021 00:01:45 -0500

Rainer Orth wrote:
> Running /vol/src/gnu/dejagnu/dejagnu-1.6.3-branch/local/testsuite/launcher.all/help.exp ...
> ERROR: The 'man' command in Solaris does not work in the source tree.
> Running /vol/src/gnu/dejagnu/dejagnu-1.6.3-branch/local/testsuite/launcher.all/interp.exp ...
> FAIL: have no Awk
> FAIL: have no GNU Awk
> FAIL: have no Tcl
> FAIL: have no Expect
>
> Running "env AWK=bogus GAWK=bogus /vol/src/gnu/dejagnu/dejagnu-1.6.3-branch/local/dejagnu --DGTimpl awk" ...
> child process exited abnormally
> FAIL: have no Awk
>
> Those FAILs happen because interp.exp expects exitcode 1 while we get
> 255 instead.  The autoconf manual documents this, too:
>
> Don't expect @command{false} to exit with status 1: in native
> Solaris @file{/bin/false} exits with status 255.
>   

Fixed in commit 9539a1e2ffe8506b92bfcb4363c767e4bc6a0700:

8<----
diff --git a/dejagnu b/dejagnu
index 9f6ae4b..ece4e09 100755
--- a/dejagnu
+++ b/dejagnu
@@ -426,13 +426,13 @@ fi
 if test -z "$command" ; then
     if test -n "$override_ext" ; then
        case $selected_ext in
-           awk)        $have_awk;      exit $? ;;
-           bash)       $have_bash;     exit $? ;;
-           exp)        $have_expect;   exit $? ;;
-           gawk)       $have_gawk;     exit $? ;;
-           tcl)        $have_tcl;      exit $? ;;
-           sh)         $have_sh;       exit $? ;;
-           *)                          exit  2 ;;
+           awk)    if $have_awk;       then exit 0; else exit 1; fi ;;
+           bash)   if $have_bash;      then exit 0; else exit 1; fi ;;
+           exp)    if $have_expect;    then exit 0; else exit 1; fi ;;
+           gawk)   if $have_gawk;      then exit 0; else exit 1; fi ;;
+           tcl)    if $have_tcl;       then exit 0; else exit 1; fi ;;
+           sh)     if $have_sh;        then exit 0; else exit 1; fi ;;
+           *)      exit 2 ;;
        esac
     else
        echo ERROR: no command given
8<----

That code did look suspiciously clever when I wrote it...

-- Jacob