Subject: Re: bug#47385: make check confused by ../../expect/expect directory

From: Jacob Bachmeyer <[email-masked]>
Date: Fri, 26 Mar 2021 23:18:29 -0500

Rainer Orth wrote:
> When running make check on Solaris, I initially got lots of failures
> like the following:
>
> Running /vol/src/gnu/dejagnu/dejagnu-1.6.3-rc1/testsuite/runtest.libs/libs.exp .
> ..
> ERROR: tcl error sourcing /vol/src/gnu/dejagnu/dejagnu-1.6.3-rc1/testsuite/runte
> st.libs/libs.exp.
> ERROR: tcl error code POSIX EACCES {permission denied}
> ERROR: couldn't execute "/vol/gcc/obj/dejagnu/dejagnu-1.6.3-rc1/../../expect/exp
> ect": permission denied
>     while executing
> "spawn $EXPECT"
>     (procedure "start_expect" line 10)
>     invoked from within
> "start_expect"
>     (file "/vol/src/gnu/dejagnu/dejagnu-1.6.3-rc1/testsuite/runtest.libs/libs.ex
> p" line 99)
>     invoked from within
> "source /vol/src/gnu/dejagnu/dejagnu-1.6.3-rc1/testsuite/runtest.libs/libs.exp"
>     ("uplevel" body line 1)
>     invoked from within
> "uplevel #0 source /vol/src/gnu/dejagnu/dejagnu-1.6.3-rc1/testsuite/runtest.libs
> /libs.exp"
>     invoked from within
> "catch "uplevel #0 source $test_file_name" msg"
>
> It turns out that there I happened to have a ../../expect/expect
> directory there.
>
> Unfortunately, lib/runtest.exp (findfile), which is called from at the
> beginning of testsuite/lib/runtest.exp, only uses "file exists" which
> also works for directories, thus the diagnosis.

You are correct that code in DejaGnu that expects to locate an 
executable can incorrectly accept a directory with search permission.

The immediate cause for these test failures is some very old code that 
had been unused for years and was updated and used as part of the new 
internal testsuite infrastructure in 1.6.3.  The support for 
automatically locating an Expect executable in the old Cygnus layout was 
misfiring on the ../../expect/expect directory you had, and this support 
will be removed in 1.6.3-rc2 and replaced with better handling of the 
EXPECT variable.  Users wishing to use a special Expect binary with 
DejaGnu's internal testsuite will need to pass EXPECT=/path/to/expect 
explicitly to either runtest or make check; additional code now ensures 
that the latter case is supported.  An entry for this change has been 
added to NEWS.

However, this will also be a known bug in the 1.6.3 release as it has 
uncovered a larger issue:  a later check in testsuite/lib/runtest.exp is 
supposed to immediately throw a fatal error if the EXPECT variable does 
not refer to an executable, but utils.exp:which has the same problem of 
accepting a directory with search permission as valid.  While 
runtest.exp:findfile is likely to be deprecated or revised, it is an 
undocumented procedure, while utils.exp:which is in the manual and is 
specified to locate executable files.

The initial fix that should allow tests to complete is in commit 
ed6511a32895f6af1451adcdd42815adcde7341a and will be included in release 
candidate 2.

-- Jacob