autoconf-patches
[Top][All Lists]
Advanced

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

Re: double-quoted command substitutions


From: Ralf Wildenhues
Subject: Re: double-quoted command substitutions
Date: Sun, 19 Feb 2006 19:55:53 +0100
User-agent: Mutt/1.5.9i

[ moving to autoconf-patches ]

* Keith Marshall wrote on Sat, Feb 18, 2006 at 06:04:05PM CET:
> On Saturday 18 February 2006 3:38 pm, Ralf Wildenhues wrote:
> > I have tried the MSYS shell now.  I can reproduce the bug mentioned in
> > the URLs there, but not on Cygwin, neither with bash on any other
> > system I could find, nor with /bin/sh on FreeBSD 5.4, OpenBSD 3.8, AIX
> > 4.3.3 HP-UX 10.20, IRIX 6.5, Solaris 2.6, Tru64 4.0D.  I don't have
> > access to older systems.
> 
> Judging from this, it would appear to be specific to the MSYS bash 
> implementation.  I'll raise a bug tracker for it, and ask Earnie to look 
> into it, when he has time.

Thanks.

OK to apply this patch to document the issue in Autoconf?  Should we
maybe just apply the documentation part?  Can we rely on the shell
builtins to use one-byte newlines at the end of their output? (I don't
know how MSYS has fared in this regard.  I merely know that with Cygwin
this is configurable, so it's probably better to play safe.)

Cheers,
Ralf

        * doc/autoconf.texi (Shell Substitutions): Mention the MSYS
        shell issue with double-quoted command substitutions of native
        commands.

        * lib/autoconf/c.m4 (AC_PROG_CC_C_O): Work around the bug as
        a safety measure, we don't want to rely on a specific EOL
        representation.
        * lib/autoconf/programs.m4 (AC_PROG_MAKE_SET): Likewise.
        * lib/autoconf/status.m4 (_AC_OUTPUT_SUBDIRS): Likewise.
        * lib/autotest/general.m4 (AT_INIT): Likewise.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.949
diff -u -r1.949 autoconf.texi
--- doc/autoconf.texi   15 Feb 2006 07:00:29 -0000      1.949
+++ doc/autoconf.texi   19 Feb 2006 18:42:59 -0000
@@ -10535,6 +10584,17 @@
 @noindent
 The result of @samp{foo=`exit 1`} is left as an exercise to the reader.
 
+The MSYS shell leaves a stray byte in the expansion of a double-quoted
+command substitution of a native program, if the end of the substution
+is not aligned with the end of the double quote.  This may be worked
+around by inserting another pair of quotes:
+
address@hidden
+$ @kbd{echo "`printf 'foo\r\n'` bar" > broken}
+$ @kbd{echo "`printf 'foo\r\n'`"" bar" | cmp - broken}
+- broken differ: char 4, line 1
address@hidden example
+
 
 @item $(@var{commands})
 @cindex $(@var{commands})
Index: lib/autoconf/c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.210
diff -u -r1.210 c.m4
--- lib/autoconf/c.m4   24 Jan 2006 00:20:15 -0000      1.210
+++ lib/autoconf/c.m4   19 Feb 2006 11:00:44 -0000
@@ -607,7 +607,7 @@
 fi
 rm -f conftest*
 ])dnl
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`""\" = yes"; then
   AC_MSG_RESULT([yes])
 else
   AC_MSG_RESULT([no])
Index: lib/autoconf/programs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v
retrieving revision 1.48
diff -u -r1.48 programs.m4
--- lib/autoconf/programs.m4    31 Dec 2005 16:44:22 -0000      1.48
+++ lib/autoconf/programs.m4    19 Feb 2006 11:00:44 -0000
@@ -712,7 +712,7 @@
   eval ac_cv_prog_make_${ac_make}_set=no
 fi
 rm -f conftest.make])dnl
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`""\" = yes"; then
   AC_MSG_RESULT([yes])
   SET_MAKE=
 else
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.84
diff -u -r1.84 status.m4
--- lib/autoconf/status.m4      6 Jan 2006 00:10:37 -0000       1.84
+++ lib/autoconf/status.m4      19 Feb 2006 11:00:44 -0000
@@ -928,7 +928,7 @@
     # parts of a large source tree are present.
     test -d $srcdir/$ac_dir || continue
 
-    ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
+    ac_msg="=== configuring in $ac_dir ("`pwd`"/$ac_dir)"
     _AS_ECHO_LOG([$ac_msg])
     _AS_ECHO([$ac_msg])
     AS_MKDIR_P(["$ac_dir"])
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.196
diff -u -r1.196 general.m4
--- lib/autotest/general.m4     11 Jan 2006 08:33:16 -0000      1.196
+++ lib/autotest/general.m4     19 Feb 2006 11:00:44 -0000
@@ -351,7 +351,7 @@
        done
        at_groups_selected=`echo "$at_groups_selected" | sed 's/;.*//'`
        # Smash the newlines.
-       at_groups="$at_groups`echo $at_groups_selected` "
+       at_groups=$at_groups`echo $at_groups_selected`" "
        ;;
 m4_divert_pop([PARSE_ARGS])dnl
 dnl Process *=* last to allow for user specified --option=* type arguments.




reply via email to

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