[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] bootstrap: AC_INIT may have up to five fields
From: |
Eric Blake |
Subject: |
Re: [PATCH] bootstrap: AC_INIT may have up to five fields |
Date: |
Wed, 08 May 2013 14:34:14 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 05/08/2013 01:33 PM, Sami Kerola wrote:
> * bootstrap: Fix determination of project name when AC_INIT has more than
> three field. The autoconf has allowed optional URL parameter since commit
> d7cc80491def26037c9e8b91d3f3aa9afd85492a (Jan, 2009).
> ---
> build-aux/bootstrap | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks; I agree that the existing sed script picks the wrong
information. However, I don't think your patch is quite right.
>
> diff --git a/build-aux/bootstrap b/build-aux/bootstrap
> index 96f1e76..a52819e 100755
> --- a/build-aux/bootstrap
> +++ b/build-aux/bootstrap
> @@ -142,7 +142,7 @@ po_download_command_format2=\
>
> extract_package_name='
> /^AC_INIT(/{
> - /.*,.*,.*, */{
The old regex tried to pick out any script that passed a fourth
parameter (the tarname), and use that in preference to the first
argument. But this is wrong if tarname was empty or if a fifth argument
is present.
> + /.*,.*,.*,.*,.*,.*/{
The new regex tries to pick out any script that passes 6 or more
arguments, which won't exist in practice, so you end up doing the
fallback to the package name (and the _rest_ of the sed script tries to
mimic autoconf logic for computing a tarname from the package name).
What we _really_ want is to reliably pick out the tarname argument if it
is not empty (hopefully, the package name, version, and bug-report
fields don't contain quoted commas), so I'm proposing this instead (and
fixing a non-portable range expression in the meantime):
From 19e35b7e68e2ef8620215304e2986c7d6863a69a Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 8 May 2013 14:29:19 -0600
Subject: [PATCH] bootstrap: AC_INIT may have more than four parameters
For packages that did
AC_INIT([package], [version], [bug-report], [], [url])
the extraction script was grabbing url instead of package for the
value of $package.
Furthermore, while we guarantee LC_ALL=C, this code is liable to
be copied and pasted to a script that doesn't use the C locale and
thus where a range expression may misbehave.
* build-aux/bootstrap (extract_package_name): Correctly extract
non-empty tarname field.
Based on a report by Sami Kerola <address@hidden>.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 7 +++++++
build-aux/bootstrap | 15 ++++++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 31f9dbf..1076227 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-05-08 Eric Blake <address@hidden>
+
+ bootstrap: AC_INIT may have more than four parameters
+ * build-aux/bootstrap (extract_package_name): Correctly extract
+ non-empty tarname field.
+ Based on a report by Sami Kerola <address@hidden>.
+
2013-05-07 Paul Eggert <address@hidden>
qacl: port to MS-Windows port of GNU Emacs
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 96f1e76..772bb45 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2013-03-08.16; # UTC
+scriptversion=2013-05-08.20; # UTC
# Bootstrap this package from checked-out sources.
@@ -140,20 +140,21 @@ po_download_command_format2=\
"wget --mirror -nd -q -np -A.po -P '%s' \
http://translationproject.org/latest/%s/"
+# Prefer a non-empty tarname (4th argument of AC_INIT if given, else
+# fall back to the package name (1st argument with munging)
extract_package_name='
/^AC_INIT(/{
- /.*,.*,.*, */{
- s///
- s/[][]//g
- s/)$//
+ /.*([^,]*,[^,]*,[^,]*,[ []*\([^][ ,]\)/{
+ s//\1/
+ s/],.*$//
p
q
}
s/AC_INIT(\[*//
- s/]*,.*//
+ s/[],)].*//
s/^GNU //
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- s/[^A-Za-z0-9_]/-/g
+ s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
p
}
'
--
1.8.1.4
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature