|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
nested [] with whitespace in misc description leads to _m4_text_wrap_word errorssome packages like to use [] in their desc and rather than use quadrigraphs,
they throw more [] at the problem. for example: AC_ARG_ENABLE(exa, AC_HELP_STRING([--disable-exa], [Disable EXA support [[default enabled]]]), [EXA="$enableval"], [EXA=yes]) or this: AC_ARG_VAR(PERLLD, [[same as PERLCC] Linker for Perl modules]) the exact output actually generated seems to vary widely over time (looking at 2.59, 2.61, 2.63, 2.64). however, while versions before 2.64 would at least output something, 2.64 simply aborts with an unhelpful message: $ cat configure.ac AC_INIT AC_ARG_VAR(VAR, [[cow moo] desc]) AC_OUTPUT $ autoconf configure:1210: error: possibly undefined macro: _m4_text_wrap_word If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. people have no idea where/why this error is coming from (although looking at the generated configure does yield some pointers). if there is no white space between the [], then things actually work and the output is what people expect: AC_INIT AC_ARG_VAR(VAR, [[cow-moo] desc]) AC_OUTPUT $ autoconf && ./configure --help | grep cow-moo VAR [cow-moo] desc -mike |
|
|
Re: nested [] with whitespace in misc description leads to _m4_text_wrap_word errors-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 According to Mike Frysinger on 10/18/2009 1:17 AM: > some packages like to use [] in their desc and rather than use quadrigraphs, > > $ cat configure.ac > AC_INIT > AC_ARG_VAR(VAR, [[cow moo] desc]) > AC_OUTPUT > > $ autoconf > configure:1210: error: possibly undefined macro: _m4_text_wrap_word Thanks for the report. The regression came at commit b07a2b3d, when I swapped to a more efficient whitespace mapping operator, and nothing in the testsuite exercises it (yet). I'm still playing with it, but I'm hoping that I can do a cleanup pass that recognizes any whitespace inside extra [ ] during _m4_split, and skip replacing just those instances. http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=b07a2b3d > if there is no white space between the [], then things actually work and the > output is what people expect: > AC_INIT > AC_ARG_VAR(VAR, [[cow-moo] desc]) > AC_OUTPUT > $ autoconf && ./configure --help | grep cow-moo > VAR [cow-moo] desc Correct, as is the use of quadrigraphs instead of raw [ and ]. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9@... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrns9sACgkQ84KuGfSFAYDWsACfd86tqGwhpG35BUK60KzbwvkU 4toAn1zGYuKXozumVbp63wL1TMidBsY7 =hM3L -----END PGP SIGNATURE----- |
|
|
Re: nested [] with whitespace in misc description leads to _m4_text_wrap_word errorsEric Blake <ebb9 <at> byu.net> writes:
> > $ cat configure.ac > > AC_INIT > > AC_ARG_VAR(VAR, [[cow moo] desc]) > > AC_OUTPUT > > > > $ autoconf > > configure:1210: error: possibly undefined macro: _m4_text_wrap_word > > Thanks for the report. The regression came at commit b07a2b3d, when I > swapped to a more efficient whitespace mapping operator, and nothing in > the testsuite exercises it (yet). I'm still playing with it, but I'm > hoping that I can do a cleanup pass that recognizes any whitespace inside > extra [ ] during _m4_split, and skip replacing just those instances. I ended up taking a different approach. Too many things use _m4_split to change its behavior, but since m4_text_wrap is already dealing with text, it turned out to be pretty simple to supply the quadrigraphs that the user should have used in the first place. However, note that whitespace inside embedded quotes is still normalized; m4_text_wrap([[a b]]) gives [a b], not [a b], and even I don't have enough m4 magic to work around that. Hmm, while writing this, I noticed a potential optimization - there is no need for m4_escape to waste time on four separate m4_bpatsubst if string didn't have any problematic bytes in the first place. I'll whip out a followup patch shortly. From: Eric Blake <ebb9@...> Date: Wed, 28 Oct 2009 08:17:27 -0600 Subject: [PATCH] Fix m4_text_wrap handling of quoted whitespace. * lib/m4sugar/m4sugar.m4 (m4_escape): New macro. (m4_text_wrap): Use it to avoid issues with embedded [ and ]. * tests/m4sugar.at (m4@&t@_text_wrap): Test it. * NEWS: Document this. * doc/autoconf.texi (Text processing Macros) <m4_escape>: Likewise. Reported by Mike Frysinger. Signed-off-by: Eric Blake <ebb9@...> --- ChangeLog | 11 +++++++++++ NEWS | 8 ++++++++ doc/autoconf.texi | 7 +++++++ lib/m4sugar/m4sugar.m4 | 17 ++++++++++++++++- tests/m4sugar.at | 15 ++++++++++++--- 5 files changed, 54 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b660bcc..0bdb5be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-10-28 Eric Blake <ebb9@...> + + Fix m4_text_wrap handling of quoted whitespace. + * lib/m4sugar/m4sugar.m4 (m4_escape): New macro. + (m4_text_wrap): Use it to avoid issues with embedded [ and ]. + * tests/m4sugar.at (m4@&t@_text_wrap): Test it. + * NEWS: Document this. + * doc/autoconf.texi (Text processing Macros) <m4_escape>: + Likewise. + Reported by Mike Frysinger. + 2009-09-16 Eric Blake <ebb9@...> Optimize AC_REPLACE_FUNCS. diff --git a/NEWS b/NEWS index 666cd4f..4fca50c 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,14 @@ GNU Autoconf NEWS - User visible changes. ** The following m4sugar macros now quote their expansion: m4_toupper m4_tolower +** The following m4sugar macros are new: + m4_escape + +** The m4sugar macro m4_text_wrap now copes with embedded quoting without + requiring quadrigraphs. For uses like AC_ARG_VAR([a], [[b c]]), + this gives the intuitive behavior of "[b c]" in the output (2.63 + gave the output of "[b], [c]", and 2.64 encountered a failure). + ** The `$tmp' temporary directory used in config.status is documented for public use now. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index a713a06..6049b59 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -12298,6 +12298,13 @@ Text processing Macros @end example @end defmac +@defmac m4_escape (@var{string}) +@msindex{escape} +Convert all instances of @samp{[}, @samp{]}, @samp{#}, and @samp{$} +within @var{string} into their respective quadrigraphs. The result is +still a quoted string. +@end defmac + @defmac m4_flatten (@var{string}) @msindex{flatten} Flatten @var{string} into a single line. Delete all backslash-newline diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index 2e53ea3..6fddff4 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -2542,6 +2542,20 @@ m4_define([m4_append_uniq_w], [m4_map_args_w([$2], [_m4_append_uniq([$1],], [, [ ])])]) +# m4_escape(STRING) +# ----------------- +# Output quoted STRING, but with embedded #, $, [ and ] turned into +# quadrigraphs. +m4_define([m4_escape], +[m4_changequote([-=<{(],[)}>=-])]dnl +[m4_bpatsubst(m4_bpatsubst(m4_bpatsubst(m4_bpatsubst( + -=<{(-=<{(-=<{(-=<{(-=<{($1)}>=-)}>=-)}>=-)}>=-)}>=-, + -=<{(#)}>=-, -=<{(@%:@)}>=-), + -=<{(\[)}>=-, -=<{(@<:@)}>=-), + -=<{(\])}>=-, -=<{(@:>@)}>=-), + -=<{(\$)}>=-, -=<{(@S|@)}>=-)m4_changequote([,])]) + + # m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH]) # ------------------------------------------------------- # Expands into STRING wrapped to hold in WIDTH columns (default = 79). @@ -2592,8 +2606,9 @@ m4_define([m4_append_uniq_w], # with m4_do, to avoid time wasted on dnl during expansion (since this is # already a time-consuming macro). m4_define([m4_text_wrap], -[_$0([$1], [$2], m4_default_quoted([$3], [$2]), +[_$0(m4_escape([$1]), [$2], m4_default_quoted([$3], [$2]), m4_default_quoted([$4], [79]))]) + m4_define([_m4_text_wrap], m4_do(dnl set up local variables, to avoid repeated calculations [[m4_pushdef([m4_Indent], m4_qlen([$2]))]], diff --git a/tests/m4sugar.at b/tests/m4sugar.at index d37681b..aa30291 100644 --- a/tests/m4sugar.at +++ b/tests/m4sugar.at @@ -1127,6 +1127,7 @@ AT_CLEANUP ## -------------- ## AT_SETUP([m4@&t@_text_wrap]) +AT_KEYWORDS([m4@&t@_escape]) # m4_text_wrap is used to display the help strings. Also, check that # commas and $ are not swallowed. This can easily happen because of @@ -1134,6 +1135,11 @@ AT_SETUP([m4@&t@_text_wrap]) AT_DATA_M4SUGAR([script.4s], [[m4_init[]m4_divert([0])dnl +m4_define([a], [OOPS])dnl +m4_escape([a[b $c#]d]) +m4_if(m4_escape([a[b $c#]d]), [a[b $c#]d], [oops], + m4_escape([a[b $c#]d]), [a@<:@b @S|@c@%:@@:>@d], [pass], [oops]) + m4_text_wrap([Short string */], [ ], [/* ], 20) m4_text_wrap([Much longer string */], [ ], [/* ], 20) @@ -1144,13 +1150,16 @@ m4_text_wrap([Short doc.], [ ], [ --too- wide], 30) m4_text_wrap([Super long documentation.], [ ], [ --too-wide], 30) -m4_text_wrap([First, second , third, [,quoted]]) +m4_text_wrap([First, second , third, [,quoted space]]) m4_define([xfff], [oops]) m4_text_wrap([Some $1 $2 $3 $4 embedded dollars.], [ $* ], [ $@ ], [0xfff & 20]) ]]) AT_DATA([expout], -[[/* Short string */ +[[a[b $c#]d +pass + +/* Short string */ /* Much longer string */ @@ -1164,7 +1173,7 @@ AT_DATA([expout], Super long documentation. -First, second , third, [,quoted] +First, second , third, [,quoted space] $@ Some $1 $2 $3 $* $4 embedded -- 1.6.4.2 |
| Free embeddable forum powered by Nabble | Forum Help |