On 12/23/2011 12:07 AM, Stefano Lattarini wrote:
> Hello autoconfers.
> 
> While testing automake on Solaris 10, I've come across another "funny"
> misbehaviour of /bin/sh: it trips up on here-documents that contains a
> command substitution *and* are fed to a shell function:
> 
And here is a patch to document the issue.  Ok for master?

Regards,
  Stefano
>From 764bdd9a85979571ce19810fec4e1297e53d959b Mon Sep 17 00:00:00 2001
Message-Id: <764bdd9a85979571ce19810fec4e1297e53d959b.1324741666.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Sat, 24 Dec 2011 16:43:36 +0100
Subject: [PATCH] docs: issue with shell functions and here-documents on
 Solaris

* doc/autoconf.texi (Here-Documents): Using a command substitution
in a here-documents being fed to a shell function is unportable.

Problem revealed by the automake testsuite:
<http://lists.gnu.org/archive/html/automake-patches/2011-12/msg00149.html>
---
 ChangeLog         |    8 ++++++++
 doc/autoconf.texi |   13 +++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0f67f89..ea874f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-12-24  Stefano Lattarini  <stefano.lattar...@gmail.com>
+
+	docs: issue with shell functions and here-documents on Solaris
+	* doc/autoconf.texi (Here-Documents): Using a command substitution
+	in a here-documents being fed to a shell function is unportable.
+	Problem revealed by the automake testsuite:
+	<http://lists.gnu.org/archive/html/automake-patches/2011-12/msg00149.html>
+
 2011-12-07  Paul Eggert  <egg...@cs.ucla.edu>
 
 	AC_LANG_BOOL_COMPILE_TRY(C): port to g++ with warnings
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index d7d2231..dc938da 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -15239,6 +15239,19 @@ bash-2.04$ @kbd{cat <<EOF
 @end group
 @end example
 
+Using command substitutions in a here-document that is fed to a shell
+function is not portable.  For example, with Solaris 10 @command{/bin/sh}:
+
+@example
+$ @kbd{kitty () @{ cat; @}}
+$ @kbd{kitty <<EOF
+> `echo ok`
+> EOF}
+/tmp/sh199886: cannot open
+$ @kbd{echo $?}
+1
+@end example
+
 Some shells mishandle large here-documents: for example,
 Solaris 10 @command{dtksh} and the UnixWare 7.1.1 Posix shell, which are
 derived from Korn shell version M-12/28/93d, mishandle braced variable
-- 
1.7.7.3

Reply via email to