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

From: Quentin Rameau <>
Date: Tue, 26 Jul 2016 10:22:48 +0200


> 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).

What is “BSD”? Are you talking about BSD 4.4?
OpenBSD's sed surely gives the same result as our sbase sed.

> Which behavior do you prefer?

That being said, I don't think that is the correct behaviour.
According to POSIX[1] (and if I understand correctly), matching the BRE
"G*" against "P" should match the null string, but not be a no match.
But in "glorious" there isn't an ethereal null string between each
character, so in addition to be an unexpected result it isn't correct to
get a replacement of "PgPlPoPrPiPoPuPsP".
I think we should just bail out with no modification, but no error
either. That last point may not be POLA, but when I think about it, that
makes sense to me.
Just my opinion though.

Received on Tue Jul 26 2016 - 10:22:48 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 26 2016 - 10:24:08 CEST