Typo in shell substitution example in autoconf manual.

2011-09-16 Thread Nick Bowler
Hello,

I was reading the portability section of the autoconf manual and I
believe there's an error in one of the examples in §11.6: Shell
Substitutions.

https://www.gnu.org/software/autoconf/manual/autoconf.html#Shell-Substitutions

The examples in question are found at the end of the subheading
${var+value}, quoted here:

  Perhaps the easiest way to work around quoting issues in a manner
  portable to all shells is to place the results in a temporary variable,
  then use ‘$t’ as the value, rather than trying to inline the expression
  needing quoting.
  
$ /bin/sh -c 't=a  b\'\''}\\; echo ${a-$t}'
b  c'}\
$ ksh -c 't=a  b\'\''}\\; echo ${a-$t}'
b  c'}\
$ bash -c 't=a  b\'\''}\\; echo ${a-$t}'
b  c'}\

I had a double take upon reading this.  I think the output for all three
of those example commands should read

  a  b'}\

rather than

  b  c'}\

as it appears in the manual.

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)



Re: Typo in shell substitution example in autoconf manual.

2011-09-16 Thread Eric Blake

On 09/16/2011 01:22 PM, Nick Bowler wrote:

$ bash -c 't=a  b\'\''}\\; echo ${a-$t}'
b  c'}\


I had a double take upon reading this.  I think the output for all three
of those example commands should read

   a  b'}\

rather than

   b  c'}\


Thanks for the report.  I'm pushing this to fix it (I actually changed 
the input of $t to start with 'b  c' rather than fixing the output, so 
that the use of $a doesn't overlap with the output).


From 2a9b77423b28ad741ab74407f680d2caaadd Mon Sep 17 00:00:00 2001
From: Eric Blake ebl...@redhat.com
Date: Fri, 16 Sep 2011 13:37:38 -0600
Subject: [PATCH] docs: fix typo in shell example

* doc/autoconf.texi (Shell Substitutions): Fix typo.
* THANKS: Update.
Reported by Nick Bowler.

Signed-off-by: Eric Blake ebl...@redhat.com
---
 ChangeLog |7 +++
 THANKS|1 +
 doc/autoconf.texi |6 +++---
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 01df9ad..76b283c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-09-16  Eric Blake  ebl...@redhat.com
+
+   docs: fix typo in shell example
+   * doc/autoconf.texi (Shell Substitutions): Fix typo.
+   * THANKS: Update.
+   Reported by Nick Bowler.
+
 2011-09-14  Stefano Lattarini  stefano.lattar...@gmail.com

docs: more details about make VPATH rewriting woes
diff --git a/THANKS b/THANKS
index 51188aa..867c0d8 100644
--- a/THANKS
+++ b/THANKS
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 3d99012..f202c10 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -15942,11 +15942,11 @@ Shell Substitutions
 the expression needing quoting.

 @example
-$ @kbd{/bin/sh -c 't=a  b\'\''@}\\; echo $@{a-$t@}'}
+$ @kbd{/bin/sh -c 't=b  c\'\''@}\\; echo $@{a-$t@}'}
 b  c'@}\
-$ @kbd{ksh -c 't=a  b\'\''@}\\; echo $@{a-$t@}'}
+$ @kbd{ksh -c 't=b  c\'\''@}\\; echo $@{a-$t@}'}
 b  c'@}\
-$ @kbd{bash -c 't=a  b\'\''@}\\; echo $@{a-$t@}'}
+$ @kbd{bash -c 't=b  c\'\''@}\\; echo $@{a-$t@}'}
 b  c'@}\
 @end example

--
1.7.4.4

--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org