Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Feb 2018 13:49:03 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 226218] "r"eading into an empty ed(1) buffer doesn't set modified status
Message-ID:  <bug-226218-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D226218

            Bug ID: 226218
           Summary: "r"eading into an empty ed(1) buffer doesn't set
                    modified status
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: freebsd@tim.thechases.com

Created attachment 191017
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D191017&action=
=3Dedit
Remove the broken check for "addr !=3D addr_last" in /usr/src/bin/ed/main.c

To reproduce:

 $ ed
 r file.txt
 314
 q
 $

Expected behavior:

 $ ed
 r file.txt
 314
 q
 ?
 q
 $

which keeps it in line with the POSIX requirement

http://pubs.opengroup.org/onlinepubs/009604599/utilities/ed.html

"If the buffer has changed since the last time the entire buffer was writte=
n,
the user shall be warned"

Reading a file changes the buffer. Compare with the correct

 $ ed
 a
 x
 .
 q
 ?
 q
 $

where the buffer is changed and the "modified" flag is properly set.

The solution appears to be to base "modified" purely on whether any lines w=
ere
read in (addr > 0), regardless of whether "addr !=3D addr_last" as performe=
d by
the attached patch.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-226218-8>