[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_INIT regression
From: |
Eric Blake |
Subject: |
Re: AC_INIT regression |
Date: |
Tue, 20 Jul 2010 07:58:14 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5 |
On 07/20/2010 07:49 AM, Eric Blake wrote:
>>> I think that's fine, but since you are at it you should also check for
>>> single quotes.
>>
>> Good point; patch for that coming up shortly.
>
> Hmm, in thinking about it, rejecting newline would also be useful, for
> catching bad uses of m4_esyscmd that accidentally left a trailing
> newline in a version string (that has come up in mailing list traffic
> several times). I'll respin my patch to catch that, too.
>
I'm squashing this in.
diff --git i/ChangeLog w/ChangeLog
index 0d5906f..bd7c15f 100644
--- i/ChangeLog
+++ w/ChangeLog
@@ -1,7 +1,8 @@
2010-07-20 Eric Blake <address@hidden>
- Also reject ' from AC_INIT strings.
- * lib/autoconf/general.m4 (_AC_INIT_LITERAL): Reject '.
+ 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
diff --git i/doc/autoconf.texi w/doc/autoconf.texi
index d878f4d..a3fe5e0 100644
--- i/doc/autoconf.texi
+++ w/doc/autoconf.texi
@@ -1845,10 +1845,10 @@ Initializing configure
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 or quotes, 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
+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,
diff --git i/lib/autoconf/general.m4 w/lib/autoconf/general.m4
index 0d86539..8e9c8cf 100644
--- i/lib/autoconf/general.m4
+++ w/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(m4_translit([[$1]], [""], [']),
-['])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 i/tests/base.at w/tests/base.at
index 1e22a1f..3fcc096 100644
--- i/tests/base.at
+++ w/tests/base.at
@@ -266,6 +266,15 @@ 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
+]])
+
+AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
+AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], [ignore])
+
AT_CLEANUP
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- autoreconf -W [was: AC_INIT regression], (continued)
- Re: AC_INIT regression, Eric Blake, 2010/07/19
- Re: AC_INIT regression, Eric Blake, 2010/07/19
- [PATCH] Fix up AC_INIT vs. " issues, and document it., Eric Blake, 2010/07/19
- Re: AC_INIT regression, Paolo Bonzini, 2010/07/20
- Re: AC_INIT regression, Eric Blake, 2010/07/20
- Re: AC_INIT regression, Eric Blake, 2010/07/20
- Re: AC_INIT regression,
Eric Blake <=
- [PATCH] Also reject ' from AC_INIT strings., Eric Blake, 2010/07/20