[Bug 226218] "r"eading into an empty ed(1) buffer doesn't set modified status

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Feb 26 13:49:05 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226218

            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 at FreeBSD.org
          Reporter: freebsd at tim.thechases.com

Created attachment 191017
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191017&action=edit
Remove the broken check for "addr != 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 written,
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 were
read in (addr > 0), regardless of whether "addr != addr_last" as performed by
the attached patch.

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


More information about the freebsd-bugs mailing list