Re: [hackers] [sbase] [PATCH 3/3] ed: Fix substitutions with non-determinate patterns

From: Evan Gates <evan.gates_AT_gmail.com>
Date: Tue, 26 Jul 2016 06:45:22 -0700

On Mon, Jul 25, 2016 at 8:47 PM, Wolfgang Corcoran-Mathe
<wcm_AT_sigwinch.xyz> wrote:
> Right, and the same behavior is shown by all the seds I’ve seen (GNU,
> BSD, Busybox & Plan 9). Interestingly, both GNU and BSD ed give an
> error instead (for global substitution against a null-matching regex).

Some more observations. Plan 9 sed has a definite bug, either way you
look at it.

    [egates-devbox ~ 616]$ echo foobar | 9 sed 's/a*/./g'
    .f.o.o.b..r

vi gives the same as 9 sed: .f.o.o.b..r

vim gives: .f.o.o.b.r

GNU awk, mawk, nawk, and 9 awk all return the same as sed, .f.o.o.b.r.
busybox awk gives .f.o.o.b..r.

9 ed gives us the same as busybox awk .f.o.o.b..r.
busybox ed is just plain broken in so many ways. I can't even get a result here.

Oh what fun! I think sed currently has the correct solution, but
that's because I spent some time convincing myself that was correct
and implementing it. I think I'll start a conversation on the Austin
ML to see what POSIX does or should require in this case. That being
said I know sbase is designed to deviate from POSIX where the result
would be complicated or non-intuitive.

emg
Received on Tue Jul 26 2016 - 15:45:22 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 26 2016 - 15:48:13 CEST