autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Properly expand @configure_input@ in config.status.


From: Ralf Wildenhues
Subject: [PATCH] Properly expand @configure_input@ in config.status.
Date: Sun, 2 Mar 2008 12:52:01 +0100
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

* lib/autoconf/status.m4 (_AC_OUTPUT_FILE, _AC_OUTPUT_MAIN_LOOP):
Escape the backslashes and ampersands in $configure_input before
using it in the sed replacement string to expand @address@hidden
Report by Eric Blake and Patrick Welche.

Signed-off-by: Benoit Sigoure <address@hidden>
Signed-off-by: Ralf Wildenhues <address@hidden>
---

There are several changes in this patch over
<http://article.gmane.org/gmane.comp.sysutils.autoconf.patches/5246>.
First, because of the GNU sed issue listed (and further discussed) In
<http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/5244/focus=5252>,
the sed delimiter was changed to '|', so the sed script generating
ac_sed_conf_input had to be adjusted, as well as the case pattern for
selecting it.  Further, in that case pattern, backslash has to be
checked for as well.  Benoit's argument in
<http://article.gmane.org/gmane.comp.sysutils.autoconf.patches/5251>
simply isn't right.

Since this should also fix the test failure Patrick reported, I've
also listed him as reporter (and Benoit as author).

Was it BTW ok to leave the Signed-off-by's in there?

Cheers,
Ralf

 ChangeLog              |    9 +++++++++
 lib/autoconf/status.m4 |   14 ++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0088f5c..38cfe8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-03-01  Benoit Sigoure  <address@hidden>
+       and Ralf Wildenhues  <address@hidden>
+
+       Properly expand @configure_input@ in config.status.
+       * lib/autoconf/status.m4 (_AC_OUTPUT_FILE, _AC_OUTPUT_MAIN_LOOP):
+       Escape the backslashes and ampersands in $configure_input before
+       using it in the sed replacement string to expand @address@hidden
+       Report by Eric Blake and Patrick Welche.
+
 2008-03-01  Ralf Wildenhues  <address@hidden>
 
        Ignore errors from ./run on w32.
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 8afa9ba..398d0cb 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -1,7 +1,7 @@
 # This file is part of Autoconf.                       -*- Autoconf -*-
 # Parameterizing and creating config.status.
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -635,7 +635,10 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 :t
 [/@[a-zA-Z_][a-zA-Z_0-9]*@/!b]
 dnl configure_input is a somewhat special, so we don't call AC_SUBST_TRACE.
-s&@configure_input@&$configure_input&;t t
+dnl Note if you change the s||| delimiter here, don't forget to adjust
+dnl ac_sed_conf_input accordingly.  Using & is a bad idea if & appears in
+dnl the replacement string.
+s|@configure_input@|$ac_sed_conf_input|;t t
 dnl During the transition period, this is a special case:
 s&@top_builddir@&$ac_top_builddir_sub&;t t[]AC_SUBST_TRACE([top_builddir])
 dnl For this substitution see the witness macro _AC_HAVE_TOP_BUILD_PREFIX 
above.
@@ -1655,6 +1658,13 @@ do
       configure_input="$ac_file.  $configure_input"
       AC_MSG_NOTICE([creating $ac_file])
     fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`AS_ECHO(["$configure_input"]) |
+       sed 's/[[\\\\&|]]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
 
     case $ac_tag in
     *:-:* | *:-) cat >"$tmp/stdin" \
-- 
1.5.4.rc5.2.g3ed9a





reply via email to

[Prev in Thread] Current Thread [Next in Thread]