Thanks for reporting that. I installed the attached patch.
From 53c23bb4e1cd8aa35248c73277fa08b7c38a6ad9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Mon, 21 Oct 2024 10:49:30 -0700
Subject: [PATCH] Avoid some echo '...\...' gotchas

Problem with AC_SUBST_FILE reported by Dylan Palauzov in:
https://lists.gnu.org/r/bug-autoconf/2024-10/msg00018.html
The other problems I found by a manual scan.
* bootstrap: Use printf, not echo.
* doc/autoconf.texi (Polymorphic Variables):
* lib/autoconf/fortran.m4 (_AC_PROG_FC_V_OUTPUT):
* lib/autoconf/general.m4 (_AC_CANONICAL_SPLIT):
* lib/autoconf/status.m4 (_AC_SUBST_FILES):
* lib/autotest/general.m4 (AT_FINISH):
Use AS_ECHO, not echo.
---
 bootstrap               | 11 +++++++----
 doc/autoconf.texi       |  2 +-
 lib/autoconf/fortran.m4 | 14 +++++++-------
 lib/autoconf/general.m4 |  2 +-
 lib/autoconf/status.m4  |  4 ++--
 lib/autotest/general.m4 |  4 ++--
 6 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/bootstrap b/bootstrap
index b2da1a0c..700ec25d 100755
--- a/bootstrap
+++ b/bootstrap
@@ -158,19 +158,22 @@ PACKAGE_BUGREPORT=$(sed -n < configure.ac \
    -e 's/^m4_define(\[autoconf_PACKAGE_BUGREPORT], \[\([^]]*\)])$/\1/p')
 
 if [ -z "$RELEASE_YEAR" ]; then
-    echo "$me: error: could not extract RELEASE_YEAR from configure.ac" >&2
+    printf >&2 '%s\n' \
+      "$me: error: could not extract RELEASE_YEAR from configure.ac"
     exit 1
 fi
 if [ -z "$VERSION" ]; then
-    echo "$me: error: could not compute VERSION" >&2
+    printf >&2 '%s\n' "$me: error: could not compute VERSION"
     exit 1
 fi
 if [ -z "$PACKAGE_NAME" ]; then
-    echo "$me: error: could not extract PACKAGE_NAME from configure.ac" >&2
+    printf >&2 '%s\n' \
+      "$me: error: could not extract PACKAGE_NAME from configure.ac"
     exit 1
 fi
 if [ -z "$PACKAGE_BUGREPORT" ]; then
-    echo "$me: error: could not extract PACKAGE_BUGREPORT from configure.ac" >&2
+    printf >&2 '%s\n' \
+      "$me: error: could not extract PACKAGE_BUGREPORT from configure.ac"
     exit 1
 fi
 
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index fd7e9ab0..565f4da3 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -14257,7 +14257,7 @@ copy the contents into a temporary literal shell variable.
 @smallexample
 for header in stdint_h inttypes_h ; do
   AS_VAR_COPY([var], [ac_cv_header_$header])
-  echo "$header detected: $var"
+  AS_ECHO(["$header detected: $var"])
 done
 @end smallexample
 @end defmac
diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index 627adf8a..c994a76a 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -522,9 +522,9 @@ rm -rf conftest*
 # On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where
 # /foo, /bar, and /baz are search directories for the Fortran linker.
 # Here, we change these into -L/foo -L/bar -L/baz (and put it first):
-ac_[]_AC_LANG_ABBREV[]_v_output="`echo $ac_[]_AC_LANG_ABBREV[]_v_output |
+ac_[]_AC_LANG_ABBREV[]_v_output=`AS_ECHO(["$ac_[]_AC_LANG_ABBREV[]_v_output"])|
 	grep 'LPATH is:' |
-	sed 's|.*LPATH is\(: *[[^ ]]*\).*|\1|;s|: */| -L/|g'` $ac_[]_AC_LANG_ABBREV[]_v_output"
+	sed 's|.*LPATH is\(: *[[^ ]]*\).*|\1|;s|: */| -L/|g'`" $ac_[]_AC_LANG_ABBREV[]_v_output"
 
 # FIXME: we keep getting bitten by quoted arguments; a more general fix
 #        that detects unbalanced quotes in FLIBS should be implemented
@@ -533,7 +533,7 @@ case $ac_[]_AC_LANG_ABBREV[]_v_output in
   # With xlf replace commas with spaces,
   # and remove "-link" and closing parenthesis.
   *xlfentry*)
-    ac_[]_AC_LANG_ABBREV[]_v_output=`echo $ac_[]_AC_LANG_ABBREV[]_v_output |
+    ac_[]_AC_LANG_ABBREV[]_v_output=`AS_ECHO(["$ac_[]_AC_LANG_ABBREV[]_v_output"]) |
       sed '
         s/,/ /g
         s/ -link / /g
@@ -544,20 +544,20 @@ case $ac_[]_AC_LANG_ABBREV[]_v_output in
   # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
   # $LIBS confuse us, and the libraries appear later in the output anyway).
   *mGLOB_options_string*)
-    ac_[]_AC_LANG_ABBREV[]_v_output=`echo $ac_[]_AC_LANG_ABBREV[]_v_output | sed 's/"-mGLOB[[^"]]*"/ /g'` ;;
+    ac_[]_AC_LANG_ABBREV[]_v_output=`AS_ECHO(["$ac_[]_AC_LANG_ABBREV[]_v_output"]) | sed 's/"-mGLOB[[^"]]*"/ /g'` ;;
 
   # Portland Group compiler has singly- or doubly-quoted -cmdline argument
   # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4.
   # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2".
   *-cmdline\ * | *-ignore\ * | *-def\ *)
-    ac_[]_AC_LANG_ABBREV[]_v_output=`echo $ac_[]_AC_LANG_ABBREV[]_v_output | sed "\
+    ac_[]_AC_LANG_ABBREV[]_v_output=`AS_ECHO([$ac_[]_AC_LANG_ABBREV[]_v_output]) | sed "\
 	s/-cmdline  *'[[^']]*'/ /g; s/-cmdline  *\"[[^\"]]*\"/ /g
 	s/-ignore  *'[[^']]*'/ /g; s/-ignore  *\"[[^\"]]*\"/ /g
 	s/-def  *'[[^']]*'/ /g; s/-def  *\"[[^\"]]*\"/ /g"` ;;
 
   # If we are using fort77 (the f2c wrapper) then filter output and delete quotes.
   *fort77*f2c*gcc*)
-    ac_[]_AC_LANG_ABBREV[]_v_output=`echo "$ac_[]_AC_LANG_ABBREV[]_v_output" | sed -n '
+    ac_[]_AC_LANG_ABBREV[]_v_output=`AS_ECHO(["$ac_[]_AC_LANG_ABBREV[]_v_output"]) | sed -n '
         /:[[	 ]]\+Running[[	 ]]\{1,\}"gcc"/{
           /"-c"/d
           /[[.]]c"*/d
@@ -567,7 +567,7 @@ case $ac_[]_AC_LANG_ABBREV[]_v_output in
 
   # If we are using Cray Fortran then delete quotes.
   *cft90*)
-    ac_[]_AC_LANG_ABBREV[]_v_output=`echo $ac_[]_AC_LANG_ABBREV[]_v_output | sed 's/"//g'` ;;
+    ac_[]_AC_LANG_ABBREV[]_v_output=`AS_ECHO("$ac_[]_AC_LANG_ABBREV[]_v_output") | sed 's/"//g'` ;;
 esac
 
 ])# _AC_PROG_FC_V_OUTPUT
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 8f40fca3..26cb0725 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2049,7 +2049,7 @@ shift; shift
 # except with old shells:
 $1_os=$[*]
 IFS=$ac_save_IFS
-case $$1_os in *\ *) $1_os=`echo "$$1_os" | sed 's/ /-/g'`;; esac
+case $$1_os in *\ *) $1_os=`AS_ECHO(["$$1_os"]) | sed 's/ /-/g'`;; esac
 AC_SUBST([$1_os])dnl
 ])# _AC_CANONICAL_SPLIT
 
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index cb53c31e..30a7d1fa 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -387,8 +387,8 @@ m4_ifdef([_AC_SUBST_FILES],
 [# Create commands to substitute file output variables.
 {
   echo 'cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1' &&
-  echo 'cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&' &&
-  echo "$ac_subst_files" | sed 's/.*/F@<:@"&"@:>@="$&"/' &&
+  AS_ECHO(['cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&']) &&
+  AS_ECHO(["$ac_subst_files"]) | sed 's/.*/F@<:@"&"@:>@="$&"/' &&
   echo "_ACAWK" &&
   echo "_ACEOF"
 } >conf$$files.sh &&
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index b846d432..6b4c3ae5 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -519,7 +519,7 @@ do
 	no | never | none) at_color=never ;;
 	auto | tty | if-tty) at_color=auto ;;
 	always | yes | force) at_color=always ;;
-	*) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'`
+	*) at_optname=`AS_ECHO([" $at_option"]) | sed 's/^ //; s/=.*//'`
 	   AS_ERROR([unrecognized argument to $at_optname: $at_optarg]) ;;
 	esac
 	;;
@@ -607,7 +607,7 @@ do
 	  at_jobs=`expr X$at_option : 'X-j\(.*\)'`
 	fi
 	case $at_jobs in *[[!0-9]]*)
-	  at_optname=`echo " $at_option" | sed 's/^ //; s/[[0-9=]].*//'`
+	  at_optname=`AS_ECHO([" $at_option"]) | sed 's/^ //; s/[[0-9=]].*//'`
 	  AS_ERROR([non-numeric argument to $at_optname: $at_jobs]) ;;
 	esac
 	;;
-- 
2.43.0

Reply via email to