bug-ed
[Top][All Lists]
Advanced

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

Re: ED on austingroupbugs


From: Andrew L. Moore
Subject: Re: ED on austingroupbugs
Date: Mon, 24 Apr 2023 00:15:36 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

For a given pattern delimiter, d, POSIX specifies that the delimiter can be included in the pattern if it is backslash-escaped (i.e., \d). So in the case d == '\\', the ed command `s\\\' should be equivalent to `s/\\//p'. My current implementation treated this as `s///' instead.
The following commit fixes this (tests needed):
https://github.com/slewsys/ed/commit/cd2c4db24927df7b0009f5a9f1d4338d72cdfd11

GNU ed has an underlying bug: the command `s/pattern` is incorrectly flagged as an error due to a missing delimiter, whereas it has always been equivalent to `s/pattern//p'. Though not spelled out explicitly by POSIX, it is traditional behavior - and consistent with the line addressing expression `/pattern' (without terminating delimiter) which GNU ed does correctly handle.
-AM

On 4/23/23 10:01, Andrew L. Moore wrote:
On 4/22/23 02:59, vico@tuta.io wrote:
Maybe you haven't read it and you'll be interested:
https://austingroupbugs.net/view.php?id=1662

POSIX does not allow a backslash delimiter in ex, but does not disallow it for ed.  And indeed, The Open Group testsuite for ed does not complain if a backslash delimiter is supported.

I'm sharing this with GNU ed maintainer, Antonio Diaz, since a single backslash (\) is permitted as a (admittedly weird) pattern delimiter in GNU, macOS and *BSD ed as well, since they all share the same codebase.

Thank you for the heads up!
-AM





reply via email to

[Prev in Thread] Current Thread [Next in Thread]