Created attachment 191017 [details] 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.