[Top][All Lists]
[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: |
Thu, 26 Oct 2006 02:24:23 -0400 (EDT) |
On Wed, 25 Oct 2006, Stepan Kasal wrote:
> As a general rule, if you write
> MACRO1([something with MACRO2])
>
> then MACRO2 will gen expanded. You have to quote twice if you want
> to preserve the literal string:
> MACRO1([[something with MACRO2]])
>
> And the same rule aplies to AT_SETUP. I think that your previous
> patch has broken this.
I figured it never made sense to put macros for later expansion into the
title argument to AT_SETUP. I didn't realize that allowing the
possibility was a general interface convention, but I guess that does at
least keep the macro interfaces easier to remember. Thanks for clarifying
that.
> I think something
> like the patch attached to this mail might be better.
I don't follow all of your changes. The patch below works for me and
cleans up the overquoting as far as I can tell.
> To do the shell escaping right, we should first expand the parameter,
> then process it by AS_ESCAPE. IOW, we need something like
> AS_ESCAPE(m4_dquote($1))
> So we are just escaping _before_ the expansion, which works only
> because people are not using m4 macros here...
Why can't the user expand his macros before passing them in? Is there
something special about expanding them after or during AT_SETUP's
expansion?
Assuming they must be expanded later, why can't we just keep $1 quoted
here and let it expand wherever it's finally placed in the output? This
works for me:
AS_ESCAPE([[$1]]))
I added a test case for this, and it seems to work fine... unless I'm
misunderstanding what's needed.
Unfortunately, I have to verify these test cases by hand since the current
AT_CHECK_AT_TITLE doesn't actually check that test case titles are
generated correctly. Maybe I'll work on that later.
Index: ChangeLog
===================================================================
RCS file: /sources/autoconf/autoconf/ChangeLog,v
retrieving revision 1.3080
diff -p -u -r1.3080 ChangeLog
--- ChangeLog 25 Oct 2006 20:21:05 -0000 1.3080
+++ ChangeLog 26 Oct 2006 06:08:00 -0000
@@ -1,3 +1,17 @@
+2006-10-26 Joel E. Denny <address@hidden>
+ and Stepan Kasal <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, Macro in a test
+ title): New tests.
+ * tests/torture.at (#define header templates): M4-quote this title in
+ AT_SETUP call so that no M4 code is commented inadvertently somewhere.
+
2006-10-25 Paul Eggert <address@hidden>
* doc/autoconf.texi (Slashes): Document Tru64 4.0 bug reported by
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 26 Oct 2006 06:08:01 -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=
@@ -1176,9 +1176,9 @@ m4_append([AT_groups_all], [ ]m4_defn([A
m4_divert_push([TESTS])dnl
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, 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 26 Oct 2006 06:08:01 -0000
@@ -244,6 +244,7 @@ conf
m4_define([AT_CHECK_AT_TITLE],
[AT_CHECK_AT([$1],
[[
+m4@&address@hidden([macro_name], [[macro expanded]])
AT_INIT([artificial test suite])
AT_SETUP([$2])
AT_CHECK([:])
@@ -253,10 +254,13 @@ 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], [[#]])
+AT_CHECK_AT_TITLE_CHAR([Macro], [macro_name])
## ----------------- ##
Index: tests/torture.at
===================================================================
RCS file: /sources/autoconf/autoconf/tests/torture.at,v
retrieving revision 1.70
diff -p -u -r1.70 torture.at
--- tests/torture.at 13 Sep 2006 04:48:24 -0000 1.70
+++ tests/torture.at 26 Oct 2006 06:08:01 -0000
@@ -319,7 +319,7 @@ AT_CLEANUP
# Use various forms of `#define' templates, and make sure there are no
# problems when a symbol is prefix of another.
-AT_SETUP([#define header templates])
+AT_SETUP([[#define header templates]])
AT_DATA([configure.ac],
[[AC_INIT
- Re: fix AT_SETUP's sh-escaping, (continued)
- Message not available
- Message not available
- Re: fix AT_SETUP's sh-escaping, Paul Eggert, 2006/10/23
- Re: fix AT_SETUP's sh-escaping, Joel E. Denny, 2006/10/25
- m4_quote [was: fix AT_SETUP's sh-escaping], Eric Blake, 2006/10/25
- Re: m4_quote [was: fix AT_SETUP's sh-escaping], Joel E. Denny, 2006/10/26
- Re: m4_quote [was: fix AT_SETUP's sh-escaping], Eric Blake, 2006/10/26
- Re: m4_quote, Paul Eggert, 2006/10/26
- Re: m4_quote, Joel E. Denny, 2006/10/26
- Re: m4_quote, Eric Blake, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Stepan Kasal, 2006/10/25
- Re: fix AT_SETUP's sh-escaping, Paul Eggert, 2006/10/25
- Re: fix AT_SETUP's sh-escaping,
Joel E. Denny <=
- Re: fix AT_SETUP's sh-escaping, Stepan Kasal, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Joel E. Denny, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Eric Blake, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Joel E. Denny, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Joel E. Denny, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Paul Eggert, 2006/10/27