From: Eric Blake Date: Tue, 20 Jul 2010 13:43:56 +0000 (-0600) Subject: Also reject ' and newline from AC_INIT strings. X-Git-Tag: v2.67~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a759826d2198c94761bc8f92847501b58253fc3a;p=thirdparty%2Fautoconf.git Also reject ' and newline from AC_INIT strings. * lib/autoconf/general.m4 (_AC_INIT_LITERAL): Reject a couple more problematic characters. * tests/base.at (AC_INIT with unusual version strings): Enhance test. * doc/autoconf.texi (Initializing configure) : Further clarifications, and clean up wording about use of m4_esyscmd. * NEWS: Update previous news entry. Suggested by Paolo Bonzini. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 1228e9be..bd7c15f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-07-20 Eric Blake + + Also reject ' and newline from AC_INIT strings. + * lib/autoconf/general.m4 (_AC_INIT_LITERAL): Reject a couple more + problematic characters. + * tests/base.at (AC_INIT with unusual version strings): Enhance + test. + * doc/autoconf.texi (Initializing configure) : Further + clarifications, and clean up wording about use of m4_esyscmd. + * NEWS: Update previous news entry. + Suggested by Paolo Bonzini. + 2010-07-20 Ralf Wildenhues Let autoreconf pass warning flags to new-enough aclocal. diff --git a/NEWS b/NEWS index a1ce5583..e8fcd3df 100644 --- a/NEWS +++ b/NEWS @@ -14,11 +14,9 @@ GNU Autoconf NEWS - User visible changes. file for inspection by the commands in the ACTION-IF-TRUE argument. ** AC_INIT again allows parentheses and other characters that are literal - in quoted and unquoted here-documents and in double-quoted strings - in its PACKAGE and VERSION arguments. This is relevant for - packages not using these strings nor products like PACKAGE_STRING - in other contexts, e.g., for Automake, and may be subject to - further restrictions in the future. Regression introduced in 2.66. + in single- or double-quoted strings, and in quoted and unquoted + here-documents, for its PACKAGE and VERSION arguments. Regression + introduced in 2.66. ** autoreconf passes warning flags to new enough versions of aclocal. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index cba4b1b1..c47d5103 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -1845,11 +1845,15 @@ other than alphanumerics and underscores are changed to @samp{-}. If provided, @var{url} should be the home page for the package. The arguments of @code{AC_INIT} must be static, i.e., there should not -be any shell computation, but they can be computed by M4 (the use of -@code{m4_esyscmd} is permissible). This is because the package -information strings are expanded at M4 time into several contexts, and -must give the same text at shell time whether used in double-quoted -strings, quoted here-documents, or unquoted here-documents. +be any shell computation, quotes, or newlines, but they can be computed +by M4. This is because the package information strings are expanded at +M4 time into several contexts, and must give the same text at shell time +whether used in single-quoted strings, double-quoted strings, quoted +here-documents, or unquoted here-documents. It is permissible to use +@code{m4_esyscmd} or @code{m4_esyscmd_s} for computing a version string +that changes with every commit to a version control system (in fact, +Autoconf does just that, for all builds of the development tree made +between releases). The following M4 macros (e.g., @code{AC_PACKAGE_NAME}), output variables (e.g., @code{PACKAGE_NAME}), and preprocessor symbols (e.g., diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index bb188459..8e9c8cf1 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -226,11 +226,12 @@ AU_ALIAS([AC_HELP_STRING], [AS_HELP_STRING]) # _AC_INIT_LITERAL(STRING) # ------------------------ -# Reject STRING if it cannot be used as-is in double-quoted strings, -# as well as quoted and unquoted here-docs. +# Reject STRING if it contains newline, or if it cannot be used as-is +# in single-quoted strings, double-quoted strings, and quoted and +# unquoted here-docs. m4_define([_AC_INIT_LITERAL], -[m4_if(m4_index([$1], dnl font-lock" -["])AS_LITERAL_HEREDOC_IF([$1], [-]), [-1-], [], +[m4_if(m4_index(m4_translit([[$1]], [ +""], ['']), ['])AS_LITERAL_HEREDOC_IF([$1], [-]), [-1-], [], [m4_warn([syntax], [AC_INIT: not a literal: $1])])]) # _AC_INIT_PACKAGE(PACKAGE-NAME, VERSION, BUG-REPORT, [TARNAME], [URL]) diff --git a/tests/base.at b/tests/base.at index 6dc9a177..3fcc096b 100644 --- a/tests/base.at +++ b/tests/base.at @@ -259,7 +259,16 @@ AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], [ignore]) AT_DATA([configure.ac], [[AC_INIT([GNU String++], - ["codename" 2.48], [http://clisp.cons.org/], [clisp]) + ['codename' 2.48], [http://clisp.cons.org/], [clisp]) +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr]) +AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], [ignore]) + +AT_DATA([configure.ac], +[[AC_INIT([GNU +String++], [2.48], [http://clisp.cons.org/], [clisp]) AC_OUTPUT ]])