* Eric Blake wrote on Wed, Jun 23, 2010 at 02:56:24PM CEST:
> On 06/22/2010 10:04 PM, Ralf Wildenhues wrote:
> > What is ksh's bigger problem with "`...\"...\"...`"?  Your previous
> > emails in this thread don't seem to describe it, so far I've been
> > of the opinion that, were it not for pdksh, this expression would be
> > portable.
> 
> Furthermore, "`...\"...\"...`" is specified by POSIX.  Were it not for
> pdksh, that would be the only compliant way to write it.

> > My patch adds an example for ksh's issue with "`..."..."...`",
> 
> Remember that POSIX says that "`..."..."...`" is unspecified - maybe we
> should add a sentence to that effect.
> 
> > the pdksh
> > reference was to avoid repeating an example for its issue with
> > "`...\"...\"...`" here.
> 
> I agree that it's nice to have only one mention of the bug, and the
> other location link to it.  But maybe it would be better to move things
> in the other direction, and have the pdksh section link to the ``
> section, so that all the pitfalls of `` are contained in one section.

All good suggestions, thanks.  Proposed update.  OK?

Thanks,
Ralf

    Further improve docs about nested double-quotes and backquotes.
    
    * doc/autoconf.texi (Shellology): Remove anchor for pdksh.
    Move quoting bug example to ...
    (Shell Substitutions): ... here.  Document which behavior is
    specified by Posix.

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 81b0845..34ae872 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -14639,7 +14639,6 @@ Shellology
 
 @item Pdksh
 @prindex @samp{pdksh}
-...@anchor{pdksh}
 A public-domain clone of the Korn shell called @command{pdksh} is widely
 available: it has most of the @samp{ksh88} features along with a few of
 its own.  It usually sets @code{KSH_VERSION}, except if invoked as
@@ -14647,20 +14646,7 @@ Shellology
 Posix compatibility by running @samp{set -o posix}.  Unfortunately, with
 @command{pdksh} 5.2.14 (the latest stable version as of January 2007)
 Posix mode is buggy and causes @command{pdksh} to depart from Posix in
-at least one respect:
-
-...@example
-$ @kbd{echo "`echo \"hello\"`"}
-hello
-$ @kbd{set -o posix}
-$ @kbd{echo "`echo \"hello\"`"}
-"hello"
-...@end example
-
-The last line of output contains spurious quotes.  This is yet another
-reason why portable shell code should not contain
-...@code{"`...@dots{}\"@dots{}\"@dots{}`"} constructs (@pxref{Shell
-Substitutions}).
+at least one respect, see @ref{Shell Substitutions}.
 
 @item Zsh
 @cindex Zsh
@@ -15163,9 +15149,22 @@ Shell Substitutions
 @end example
 
 @noindent
-Worse yet, not all shells understand @code{"`...@dots{}\"@dots{}\"@dots{}`"}
-the same way (@pxref{pdksh}).  There is just no portable way to use 
double-quoted
-strings inside double-quoted back-quoted expressions (pfew!).
+Posix does not specify behavior for this sequence.  On the other hand,
+behavior for @code{"`...@dots{}\"@dots{}\"@dots{}`"} is specified by Posix,
+but in practice, not all shells understand it the same way: pdksh 5.2.14
+prints spurious quotes when in Posix mode:
+
+...@example
+$ @kbd{echo "`echo \"hello\"`"}
+hello
+$ @kbd{set -o posix}
+$ @kbd{echo "`echo \"hello\"`"}
+"hello"
+...@end example
+
+...@noindent
+There is just no portable way to use double-quoted strings inside
+double-quoted back-quoted expressions (pfew!).
 
 @table @code
 @item $@@

Reply via email to