bug-ed
[Top][All Lists]
Advanced

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

Re: [Bug-ed] Ed scripts failing in versions after ~1.10


From: David Given
Subject: Re: [Bug-ed] Ed scripts failing in versions after ~1.10
Date: Tue, 22 May 2018 21:53:59 +0200

Ah --- sorted!

The 1 is being returned because an error is occurring further up the file, which is being hidden in amongst the other output. These lines:

g/:w/s/^\(...\).*/#define C_\1(w) CC_opcst(op_\1, w)\
#define C_\1_narg() CC_opnarg(op_\1)/

...worked in 1.10, but not in 1.14; you can't replace with a literal newline like this any more and 1.14 is producing an 'invalid newline substitution' error. So the 1 status code was actually ed trying to be helpful and telling me that something was wrong.

So I believe that's all WAI.

On a related note --- any ideas how to adjust the script to work on modern eds? Line splitting inside a g is explicitly forbidden by both Posix and the GNU ed manual for reasons of ambiguity.

On Tue, 22 May 2018 at 21:32 David Given <address@hidden> wrote:
It's worth mentioning that the ed these scripts were written for didn't have the buffer-modified warning at all --- the scripts are full of fragments like this:

ed - $em_table <<'A' > X
1,/^$/g/ /s// /gp
A

(from https://github.com/davidgiven/ack/blob/4d24666432a4a01a67ed9b993c912f44b4cfe0a8/modules/src/em_data/new_table, written in 1985.)

I believe this worked fine on 1.10.


On Tue, 22 May 2018 at 20:41 Ori Avtalion <address@hidden> wrote:
The non-zero exit status only appears with 1.14.2, and not with 1.13.
Executing the H command reveals that the ? warning is "buffer modified".

The relevant change is likely:
>The modified status is no longer cleared after writing the buffer to the
>standard input of a shell command. (Reported by Jérôme Frgacic).

Reported at https://lists.gnu.org/archive/html/bug-ed/2016-08/msg00000.html

When the Q command is issued on a modified buffer, I don't understand
why ed exits with exit status 1 instead of 0. No error has occurred.

reply via email to

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