bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CVS autoconf testsuite failure on Tru64 unix


From: Noah Misch
Subject: Re: CVS autoconf testsuite failure on Tru64 unix
Date: Mon, 13 Dec 2004 12:00:21 -0800
User-agent: Mutt/1.5.6i

On Sun, Dec 12, 2004 at 01:54:38AM -0800, Paul Eggert wrote:
> Noah Misch <address@hidden> writes:
> 
> > -        *[[^\\]]"$at_lf"*) at_reason='an embedded newline' ;;
> > +        *\\"$at_lf"*)      at_reason= ;;
> > +        *"$at_lf"*)        at_reason='an embedded newline' ;;
> 
> I installed your patch, as it's an improvement, but this part of it
> still looks wrong to me.  For example, the following shell command
> contains an embedded newline, but the code wouldn't catch it:
> 
>   foo="bar\\
>   baz"

I fixed it like this:  That said,

    case "$at_cmd_expanded" in
        *\$\(*\)*)         at_reason='a $(...) command substitution' ;;
        *\`*\`*)           at_reason='a `...` command substitution' ;;
        # A single-quote may make `\<newline>' literal.
        *\'*"$at_lf"*)     at_reason='an embedded newline' ;;
        *\\"$at_lf"*)
            # An odd number of backslashes quotes an embedded newline.
            if grep '^\(\\\\\)*\\$'"$at_lf"'[^\]\(\\\\\)*\\$' >/dev/null 2>&1
                then  at_reason=
                else  at_reason='an embedded newline'
            fi
            ;;
        *"$at_lf"*)        at_reason='an embedded newline' ;;
        *)                 at_reason= ;;
    esac

> Wouldn't it be safer to report all newlines, even those preceded by
> backslash?

let us just do this.  Rarely will testsuite authors read the documentation and
then escape their newlines just to make `./testsuite -x' helpful.  Furthermore,
thanks to single quotes, I see no test in the Autoconf test suite that we could
make traceable by escaping newlines.  This is probably representative of the
situation in most test suites.

The appended patch also adds a number of test cases that illustrate shortcomings
of earlier code.  They all pass with this patch or the above implementation.

> (The other Tru64 issues in this area still remain, right?)

Yes.  I have a fix cooking.



2004-12-13  Noah Misch  <address@hidden>

        * lib/autotest/general.m4 (_AT_CHECK) [--trace]: Do not enable shell
        tracing on commands with possibly-escaped newlines.
        * doc/autoconf.texi (Writing testsuite.at): Delete documentation of the
        discontinued behavior and its implications.
        * tests/autotest.at (BS-newline in command, ^BS-newline in command)
        (BSx641-newline in command, BS-BS-newline in command)
        (BSx640-newline in command, Newline-CODE-BS-newline in command)
        (Single-quote-BS-newline in command)
        (Single-quote-newline-BS-newline in command): New tests.

diff -urp --exclude=Makefile.am -X dontdiff ac-clean/doc/autoconf.texi 
ac-bs_lf/doc/autoconf.texi
--- ac-clean/doc/autoconf.texi  2004-12-12 14:43:28.629162405 -0500
+++ ac-bs_lf/doc/autoconf.texi  2004-12-12 20:04:02.130343502 -0500
@@ -15442,29 +15442,6 @@ commands @var{run-if-pass}.
 The @var{commands} @emph{must not} redirect the standard output, nor the
 standard error.
 
-If the @var{commands} may contain a newline, @command{testsuite} will
-not enable shell tracing for them when the user passes @option{-x}.
-Since unquoted, unescaped literal newlines are never necessary to
-achieve particular semantics, escape them.  For example, avoid this:
-
address@hidden
-cat LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG |
-  grep fairly-long-in-its-own-right
-echo "A sentence."
address@hidden display
-
-Write this instead:
-
address@hidden
-cat LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG | \
-  grep fairly-long-in-its-own-right ; \
-echo "A sentence."
address@hidden display
-
-The presence in @var{commands} of any command substitution or a
-parameter expansion yielding multiple lines also inhibits shell tracing,
-but those constructs are rarely so easy to remove.
-
 If @var{status}, or @var{stdout}, or @var{stderr} is @samp{ignore}, then
 the corresponding value is not checked.
 
diff -urp --exclude=Makefile.am -X dontdiff ac-clean/lib/autotest/general.m4 
ac-bs_lf/lib/autotest/general.m4
--- ac-clean/lib/autotest/general.m4    2004-12-12 14:43:29.258339275 -0500
+++ ac-bs_lf/lib/autotest/general.m4    2004-12-13 14:15:31.003313935 -0500
@@ -1234,7 +1234,6 @@ if test -n "$at_traceon"; then
     case "$at_cmd_expanded" in
         *\$\(*\)*)         at_reason='a $(...) command substitution' ;;
         *\`*\`*)           at_reason='a `...` command substitution' ;;
-        *\\"$at_lf"*)      at_reason= ;;
         *"$at_lf"*)        at_reason='an embedded newline' ;;
         *)                 at_reason= ;;
     esac
diff -urp --exclude=Makefile.am -X dontdiff ac-clean/tests/autotest.at 
ac-bs_lf/tests/autotest.at
--- ac-clean/tests/autotest.at  2004-12-10 02:08:52.000000000 -0500
+++ ac-bs_lf/tests/autotest.at  2004-12-13 14:28:12.206612735 -0500
@@ -111,6 +111,58 @@ bar
 bar
 ], [])])
 
+AT_CHECK_AT_TEST([BS-newline in command],
+  [AT_CHECK([echo Auto"\
+"conf], 0, [Autoconf
+], [])])
+
+AT_CHECK_AT_TEST([^BS-newline in command],
+  [AT_CHECK([\
+echo GNU], 0, [GNU
+], [])])
+
+AT_CHECK_AT_TEST([BSx641-newline in command],
+  [AT_CHECK([echo 
Auto"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+"conf], 0, 
[Auto\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\conf
+], [])])
+
+AT_CHECK_AT_TEST([BS-BS-newline in command],
+  [AT_CHECK([echo Auto"\\
+"conf], 0, [Auto\
+conf
+], [])])
+
+# A `^BS-BS-newline in command' test will run a command named `\'.  No, thanks.
+
+AT_CHECK_AT_TEST([BSx640-newline in command],
+  [AT_CHECK([echo 
Auto"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+"conf], 0, 
[Auto\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+conf
+], [])])
+
+# This command has both escaped and unescaped newlines.
+AT_CHECK_AT_TEST([Newline-CODE-BS-newline in command],
+  [AT_CHECK([echo Auto'
+'co\
+nf], 0, [Auto
+conf
+], [])])
+
+AT_CHECK_AT_TEST([Single-quote-BS-newline in command],
+  [AT_CHECK([echo Auto'\
+'conf], 0, [Auto\
+conf
+], [])])
+
+AT_CHECK_AT_TEST([Single-quote-newline-BS-newline in command],
+  [AT_CHECK([echo Auto'
+\
+'conf], 0, [Auto
+\
+conf
+], [])])
+
+
 ## ------------------------------- ##
 ## Funny characters in test names. ##
 ## ------------------------------- ##




reply via email to

[Prev in Thread] Current Thread [Next in Thread]