tech-userlevel archive

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

Re: sh(1) vs. ksh(1)



In article <20081025200005.GE321%apb-laptoy.apb.alt.za@localhost>,
Alan Barrett  <apb%cequrux.com@localhost> wrote:
>On Fri, 24 Oct 2008, Patrick Welche wrote:
>> > I am not sure that the meaning of <backslash><doublequote> inside
>> > backquotes inside double quotes is well defined.  The NetBSD ksh(1) man
>> > page says that it behaves differently depending on whether or not pOSIX
>> > mode is in effect.  See these extracts from the ksh(1) man page: 
>> 
>> cf bin/26493
>
>NetBSD ksh behaves just like pdksh here (varying its interpretation of
>
>       echo "`echo \"hi\"`"
>
>according to whether "set -o posix" or "set +o posix" is in effect.
>
>ksh93 doesn't even have a "set -o posix" mode, and behaves in the
>sensible way.
>
>Comments in src/usr.bin/ksh/lex.c quote parts of
>some version of the POSIX specification.  The
>wording quoted is very similar to that in SUSv3
><http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html>
>but the authors of pdksh apparently interpreted the wording differently
>from everybody else.  To me, it seems clear that the words "having
>escape characters removed" mean, in that context, that the backslash
>before the double quote in "...`...\"...`..." is removed as part of
>the handling of the outer double quotes, so that the backslash is not
>present when the inner backquotes are handled.
>
>Are there any objections to the following patch, which makes NetBSD
>ksh handle "...`...\"...`..." in the same way regardless of posix mode
>or non-posix mode?  To make the patch readable, I have not changed the
>indentation of the inside of the if...{...} block.  If the patch is
>acceptable then I would change the indentation before committing.)
>

Why not just turn on posix mode by default? It is less intrusive.

christos



Home | Main Index | Thread Index | Old Index