bug-ed
[Top][All Lists]
Advanced

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

potential inconsistency with buffer modified flag


From: Eric Blake
Subject: potential inconsistency with buffer modified flag
Date: Thu, 9 Nov 2023 11:35:02 -0600
User-agent: NeoMutt/20231023

During today's Austin Group meeting (the folks working on POSIX), we
noticed an inconsistency in GNU ed when compared to other
implementations.  It seems that ALL implementations we tested allow
'q' to quit immediately after an 'e' that failed because the buffer
still has unwritten modifications:

$ echo one > 1
$ ed 1
4
s/o/o/
e
?
q
$

We then tried to figure out what other commands, if any, can be used
in between notification that a buffer was modified and a followup
attempt to quit.  On MacOS, 'h' does not count as an intervening
command:

$ ed 1
4
s/o/o/
e
?
h
Warning: file modified
q
$

But with GNU ed, the mere use of 'h' restarts the modified buffer
cycle:

$ ed 1
4
s/o/o/
e
?
h
Warning: buffer modified
q
?
q
$

Logically, however, the 'h' command exists to tell me why I just got
'?' as output; and doesn't seem like it should be modifying the buffer
at all, so in this case, the MacOS behavior made more sense.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org




reply via email to

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