In case you wonder which patch i'm talking about, here it is. Note this is not against -current, but against the backed-out version for brevity.
Not fishing for OKs at this time, just FYI. Index: process.c =================================================================== RCS file: /cvs/src/usr.bin/sed/process.c,v retrieving revision 1.16 diff -u -p -r1.16 process.c --- process.c 24 Jul 2011 13:59:15 -0000 1.16 +++ process.c 26 Jul 2011 09:03:31 -0000 @@ -363,11 +363,12 @@ substitute(struct s_command *cp) * and at the end of the line, terminate. */ if (match[0].rm_so == match[0].rm_eo) { - if (*s == '\n') + if (*s == '\0' || *s == '\n') slen = -1; else slen--; - cspace(&SS, s++, 1, APPEND); + if (*s != '\0') + cspace(&SS, s++, 1, APPEND); lastempty = 1; } else lastempty = 0; ----- Forwarded message from Ingo Schwarze <schwa...@cvs.openbsd.org> ----- From: Ingo Schwarze <schwa...@cvs.openbsd.org> Date: Tue, 26 Jul 2011 02:47:07 -0600 (MDT) To: source-chan...@cvs.openbsd.org Subject: CVS: cvs.openbsd.org: src CVSROOT: /cvs Module name: src Changes by: schwa...@cvs.openbsd.org 2011/07/26 02:47:07 Modified files: usr.bin/sed : process.c Log message: Backout previous, naddy@ found the following regression: When the input does not end in a trailing newline character and there is an empty match at the end, the new code adds a spurious '\0' character. I have a fix, but otto@ prefers backout and full re-evaluation after release. ----- End forwarded message -----