Subject: Re: bug#47382: runtest doesn't work with Solaris 10 /bin/sh

From: Rainer Orth <[email-masked]>
Date: Wed, 14 Apr 2021 16:12:28 +0200

Hi Jacob,

>>   I'd already noticed another instance of the problem after I'd sent the
>>   original PR: while e.g. autoconf-generated configure and related in
>>   gcc are very careful to invoke config.guess only prefixed with $SHELL,
>>   runtest.exp exec's it directly, again falling into the trap of POSIX
>>   shell constructs (also $(), maybe more).
>>   
>
> The "exec" used in this case is Tcl's exec(n), which simply invokes the
> installed copy of config.guess (via the system) with the interpreter 
> indicated in the file.  The patch now applied by configure should correct
> this issue.

true, but according to my manual testing

exec $SHELL $config_guess

with SHELL initialized from CONFIG_SHELL, works just as well and avoids
having to substitute the scripts imported from upstream.

>> However, there are more errors still:
>>
>> [...]
>>
>> Running
>> /vol/src/gnu/dejagnu/dejagnu-1.6.3-rc2/testsuite/report-card.all/onetest
>> .exp ...
>> spawn /bin/sh -c cd
>> /vol/gcc/obj/dejagnu/dejagnu-1.6.3-rc2/testsuite/report-card
>> .all/onetest && exec /vol/src/gnu/dejagnu/dejagnu-1.6.3-rc2/dejagnu
>> report-card^
>> M
>> expr: syntax error
>> ERROR: could not resolve command dejagnu-report-card
>>
>> There are obviously more hardcoded uses of /bin/sh here and elsewhere,
>> but I haven't looked for those yet.
>
> If this issue remains in rc3, I repeat my request for execution traces
> under both /bin/sh and /bin/ksh for the rc3 version of the dejagnu 
> launcher script.  Please attach the output of "/bin/ksh -x ./dejagnu
> report-card" and "/bin/sh -x ./dejagnu report-card" with both run in the 
> DejaGnu source directory when you get the chance if there are still issues.

It does, and happens with both /bin/sh and /bin/ksh: here's an excerpt
from running

env EXPECT=true TCLSH=true /bin/ksh -x /vol/gcc/obj/dejagnu/dejagnu-1.6.3-rc3/10-fresh/testsuite/launcher.all/command/bin/dejagnu foo -v -v

+ test -f /vol/gcc/obj/dejagnu/dejagnu-1.6.3-rc3/10-fresh/testsuite/launcher.all
/command/share/dejagnu/commands/dejagnu.sh
+ expr foo : -
+ 1> /dev/null
expr: syntax error

There are several more instances, all for

expr foo : -

Solaris /bin/expr just errors out with

expr: syntax error

This applies not only to Solaris 10 /bin/expr, but also to the Solaris
11.4 one as well as /usr/xpg6/bin/expr there.  It seems this is no
wonder:

expr foo : -

is not in XPG7/POSIX.1 and the autoconf manual explicitly states that
this is an unportable non-POSIX extension.