]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Also reject ' and newline from AC_INIT strings.
authorEric Blake <eblake@redhat.com>
Tue, 20 Jul 2010 13:43:56 +0000 (07:43 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 20 Jul 2010 14:01:15 +0000 (08:01 -0600)
* 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) <AC_INIT>: 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 <eblake@redhat.com>
ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/general.m4
tests/base.at

index 1228e9be40d42c9a939e2616fa97e3b9d25269c8..bd7c15f8ee0973e680d2c1fe04460c4749c993fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-20  Eric Blake  <eblake@redhat.com>
+
+       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) <AC_INIT>: 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  <Ralf.Wildenhues@gmx.de>
 
        Let autoreconf pass warning flags to new-enough aclocal.
diff --git a/NEWS b/NEWS
index a1ce55831a061849ac2b32c8e70ab8d68d22b499..e8fcd3dfb1b80cfab9f433b5c6c58bf6c9c06441 100644 (file)
--- 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.
 
index cba4b1b1cff15b1f7fd297e7119546146bf71efc..c47d510339830ce019966143dedf4b5b74a90332 100644 (file)
@@ -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.,
index bb188459e7683a570f72bb0429fd18b2286ad458..8e9c8cf119ce36fbadb0ca50179784e1d89febd8 100644 (file)
@@ -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])
index 6dc9a177dbdb9894578d8267d71a3d195e7868fd..3fcc096be3f3bfdce64d28c77d2613d48d8ff095 100644 (file)
@@ -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
 ]])