tech-userlevel archive

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

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

On Sat, 25 Oct 2008, Christos Zoulas wrote:
> >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.

I think posix mode is on by default in NetBSD ksh, but that's
irrelevant to this problem.

The problem is that, in what ksh calls "posix mode", the interpretation
of "...`...\"...`..." is not compatible with POSIX.  However, in what
ksh calls non-posix mode, the behaviour of "...`...\"...`..." is
compatible with POSIX.  One would normally expect something named "posix
mode" to turn *on* behaviour compatible with the POSIX standard, and the
fact that ksh uses "posix mode" to turn *off* behaviour compatible with
POSIX just seems broken.

The previous comments in lex.c make it clear that the previous behaviour
was deliberate, but the parts of the POSIX standard quoted in the
previous comments do not support the previous behaviour.  So I believe
that the previous authors misinterpreted POSIX, and the new comments (in
my patch) say that.  Do you disagree?

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index