autoconf-patches
[Top][All Lists]
Advanced

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

Re: fix AT_SETUP's sh-escaping


From: Joel E. Denny
Subject: Re: fix AT_SETUP's sh-escaping
Date: Wed, 25 Oct 2006 04:20:40 -0400 (EDT)

On Mon, 23 Oct 2006, Paul Eggert wrote:

> First, shouldn't that m4_dquote be m4_quote?

As far as I can tell, m4_quote does nothing.  That is, the quotes it adds 
are just stripped immediately upon return.  I'm really not sure why 
m4_quote exists, but maybe I'm just missing something.

> Second, it'd be a bit
> nicer if the initialization of at_help_all had one double-quote at the
> start and one at the end, rather than lots of double-double-quotes
> sprinkled throughout.

Ok, I changed it.

> Third and most important, I tried the patch in
> CVS Autoconf, and it failed as follows.  Can you please look into
> this?

Sorry, for some reason I didn't try the test suite.

It seems I was underquoting the argument to AS_ESCAPE.  Or perhaps 
AS_ESCAPE is underquoting its return.  That is, I'm not sure why the 
return of AS_ESCAPE should ever be m4 expanded.

Anyway, a test case with a # in the title uncovered this bug.  Without the 
following patch, [] in the title does not show up in testsuite -l, but the 
existing AT_CHECK_AT_TITLE_CHAR doesn't check this.  I've added test cases 
for these characters anyway.  I don't have time to extend the test suite 
further right now.

Here's a new patch.

Index: ChangeLog
===================================================================
RCS file: /sources/autoconf/autoconf/ChangeLog,v
retrieving revision 1.3078
diff -p -u -r1.3078 ChangeLog
--- ChangeLog   25 Oct 2006 00:35:45 -0000      1.3078
+++ ChangeLog   25 Oct 2006 08:08:04 -0000
@@ -1,3 +1,13 @@
+2006-10-25  Joel E. Denny  <address@hidden>
+
+       Handle special characters in test case titles correctly.
+       * lib/autotest/general.m4 (AT_INIT): Make sure at_help_all is
+       AS_ESCAPE'd properly.
+       (AT_SETUP): m4 quote and AS_ESCAPE the title properly everywhere.
+       * tests/autotest.at (Backquote in a test title, Single-quote in a test
+       title, Double-quote in a test title): Don't expect failure anymore.
+       (Brackets in a test title, Pound in a test title): New tests.
+
 2006-10-24  Paul Eggert  <address@hidden>
 
        * doc/autoconf.texi (Limitations of Usual Tools): Document that rm
Index: lib/autotest/general.m4
===================================================================
RCS file: /sources/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.215
diff -p -u -r1.215 general.m4
--- lib/autotest/general.m4     15 Oct 2006 01:12:02 -0000      1.215
+++ lib/autotest/general.m4     25 Oct 2006 08:08:05 -0000
@@ -279,7 +279,7 @@ at_groups_all='AT_groups_all'
 # numerical order.
 at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])'
 # Description of all the test groups.
-at_help_all='AT_help_all'])])dnl
+at_help_all="AS_ESCAPE(m4_dquote(AT_help_all))"])])dnl
 m4_divert_push([PARSE_ARGS])dnl
 
 at_prev=
@@ -1170,15 +1170,15 @@ m4_define([AT_SETUP],
 m4_ifdef([AT_capture_files], [m4_undefine([AT_capture_files])])
 m4_define([AT_line], AT_LINE)
 m4_define([AT_xfail], [at_xfail=no])
-m4_define([AT_description], [$1])
+m4_define([AT_description], [[$1]])
 m4_define([AT_ordinal], m4_incr(AT_ordinal))
 m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))
 m4_divert_push([TESTS])dnl
-  AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1
+  AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): [$1]
     at_setup_line='m4_defn([AT_line])'
-    at_desc='$1'
+    at_desc="AS_ESCAPE([[$1]])"
     $at_quiet $ECHO_N "m4_format([%3d: %-]m4_eval(47 - m4_qdelta([$1]))[s],
-                      AT_ordinal, [[$1]])[]$ECHO_C"
+                      AT_ordinal, m4_dquote(AS_ESCAPE([[$1]])))[]$ECHO_C"
 m4_divert_push([TEST_SCRIPT])dnl
 ])
 
Index: tests/autotest.at
===================================================================
RCS file: /sources/autoconf/autoconf/tests/autotest.at,v
retrieving revision 1.17
diff -p -u -r1.17 autotest.at
--- tests/autotest.at   24 May 2006 03:46:00 -0000      1.17
+++ tests/autotest.at   25 Oct 2006 08:08:07 -0000
@@ -253,10 +253,12 @@ AT_CLEANUP
 m4_define([AT_CHECK_AT_TITLE_CHAR],
 [AT_CHECK_AT_TITLE([$1 in a test title], [A $2 in my name], $3)])
 
-AT_CHECK_AT_TITLE_CHAR([Backquote],    [`], [:])
-AT_CHECK_AT_TITLE_CHAR([Single-quote], ['], [:])
-AT_CHECK_AT_TITLE_CHAR([Double-quote], ["], [:])
+AT_CHECK_AT_TITLE_CHAR([Backquote],    [`])
+AT_CHECK_AT_TITLE_CHAR([Single-quote], ['])
+AT_CHECK_AT_TITLE_CHAR([Double-quote], ["])
 AT_CHECK_AT_TITLE_CHAR([Backslash],    [\])
+AT_CHECK_AT_TITLE_CHAR([Brackets],    [[]])
+AT_CHECK_AT_TITLE_CHAR([Pound],        [#])
 
 
 ## ----------------- ##




reply via email to

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