Hi,

pdksh and mksh R52 (the latest release), but not some intermediate
versions, do this, note POSIX mode:

tg@blau:~ $ cat x
ACRO_INSTALL_DIR=/usr/Acroread/Reader
directory="`basename \"$ACRO_INSTALL_DIR\"`"
echo "<$directory>"
tg@blau:~ $ mksh -o posix x
<Reader">
tg@blau:~ $ mksh x
<Reader>

None of the other shells I tested so far has this (not even
bash --posix), but the behaviour is consistent with the comments
found in pdksh source code which I reformatted and resynchronised
with the current section numbers:

/*
 * We need to know whether we are within double
 * quotes, since most shells translate \" to "
 * within "…`…\"…`…". This is not done in POSIX
 * mode (§2.2.3 Double-Quotes: “The backquote
 * shall retain its special meaning introducing
 * the other form of command substitution (see
 * Command Substitution). The portion of the
 * quoted string from the initial backquote and
 * the characters up to the next backquote that
 * is not preceded by a <backslash>, having
 * escape characters removed, defines that
 * command whose output replaces "`...`" when
 * the word is expanded.”; §2.6.3 Command
 * Substitution: “Within the backquoted style
 * of command substitution, <backslash> shall
 * retain its literal meaning, except when
 * followed by: '$', '`', or <backslash>. The
 * search for the matching backquote shall be
 * satisfied by the first unquoted non-escaped
 * backquote; during this search, if a
 * non-escaped backquote is encountered[…],
 * undefined results occur.”).
 */

I only noticed this being a problem now because some legacy
script (with /bin/sh shebang, which invokes POSIX mode on
some systems with mksh) breaks due to it.

Question:

Am I interpreting the current standard correctly, and is
<Reader"> indeed the only correct output? If yes, will this
also be true for a future version of the standard (as far
as this can be said currently, i.e. are there any plans to
change it)? If no, is <Reader> a/the correct output?

Thanks in advance,
//mirabilos, who really really really dislikes U+0060
-- 
(gnutls can also be used, but if you are compiling lynx for your own use,
there is no reason to consider using that package)
        -- Thomas E. Dickey on the Lynx mailing list, about OpenSSL

Reply via email to