[Tcsh] 6.22.03: testsuite failures due to unbalanced parentheses

Christian Weisgerber naddy at mips.inka.de
Sat Jan 30 23:35:17 UTC 2021


Running the testsuite for tcsh 6.22.03 on OpenBSD shows three failures:
139 182 196

The errors are all alike:

------------------->
139: Filename substitution                          ./tests/testsuite: /usr/obj/
tcsh-6.22.03/tcsh-6.22.03/testsuite.dir/at-groups/139/test-source[79]: syntax er
ror: `}' unexpected
testsuite: WARNING: unable to parse test group: 139
testsuite: WARNING: A failure happened in a test group before any test could be
testsuite: WARNING: run. This means that test suite is improperly designed.  Please
testsuite: WARNING: report this failure to <https://bugs.astron.com/>.
 FAILED (subst.at:29)
<-------------------

A closer look at the testsuite script reveals that autom4te generates
invalid shell code:

------------------->
( $at_check_trace; ((
case "$(uname -s)" in
Darwin)
    HOME=$(dscl . read "/Users/$USER" NFSHomeDirectory | awk '{ print $NF }')
    ;;
*)
    HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }')
    ;;
esac;
export HOME;
echo 'echo ~; echo "$HOME"' | tcsh -f | uniq | wc -l | tr -d ' \t'

) >>"$at_stdout" 2>>"$at_stderr" 5>&-
<-------------------

Notice the trailing "((" in the first line.  Whether you treat is
as opening a ksh-style arithmetic expression or two sub-shells, it
is unmatched and simply wrong.

I have been unable to find details, but apparently some processing
step in autom4te inserts the corresponding number of opening
parentheses to match the closing ones that are part of the case
statement.  This seems related:
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Balancing-Parentheses.html

I'm uncertain what the correct solution is, but []-quoting the
parentheses in the case statements fixes the problem:

--- tests/subst.at.orig
+++ tests/subst.at
@@ -52,10 +52,10 @@ foo* ab{c,d} ^fo*
 
 AT_CHECK([
 case "$(uname -s)" in
-Darwin)
+Darwin[)]
     HOME=$(dscl . read "/Users/$USER" NFSHomeDirectory | awk '{ print $NF }')
     ;;
-*)
+*[)]
     HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }')
     ;;
 esac;
@@ -67,10 +67,10 @@ echo 'echo ~; echo "$HOME"' | tcsh -f | uniq | wc -l |
 
 AT_CHECK([
 case "$(uname -s)" in
-Darwin)
+Darwin[)]
     HOME=$(dscl . read "/Users/$USER" NFSHomeDirectory | awk '{ print $NF }')
     ;;
-*)
+*[)]
     HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }')
     ;;
 esac;
--- tests/variables.at.orig
+++ tests/variables.at
@@ -593,10 +593,10 @@ echo $home
 ]])
 AT_CHECK([
 case "$(uname -s)" in
-Darwin)
+Darwin[)]
     HOME=$(dscl . read "/Users/$USER" NFSHomeDirectory | awk '{ print $NF }')
     ;;
-*)
+*[)]
     HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }')
     ;;
 esac;
@@ -721,10 +721,10 @@ AT_CLEANUP
 AT_SETUP([$ cdtohome])
 AT_CHECK([
 case "$(uname -s)" in
-Darwin)
+Darwin[)]
     HOME=$(dscl . read "/Users/$USER" NFSHomeDirectory | awk '{ print $NF }')
     ;;
-*)
+*[)]
     HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }')
     ;;
 esac;

-- 
Christian "naddy" Weisgerber                          naddy at mips.inka.de


More information about the Tcsh mailing list