sed(1) a/c/i command line continuation bug

Issue #125 resolved
Takehiko NOZAKI repo owner created an issue

the bug originaly reported by Keith Bostic via Kirk McKusick, and already fixed for more than 20years ago.

try following:

$ cat >test.txt
aaa\^D^D
$ cat >test.sed
c\
bbb\^D^D
$ sed -f test.sed test.txt

NetBSD's result:

bbb

FreeBSD/OpenBSD result:

bbb\

Comments (3)

  1. Takehiko NOZAKI reporter

    BUGFIX: Issue #125 -- fix line continuation bug, other *BSD fixed it more than 20 years ago.

    https://svnweb.freebsd.org/base?view=revision&revision=39571 Terminate our output string correctly if we've got an ``a'' command that has an escaped newline on the last line of the last script that we're processing.

    This fixes exmh2/scripts/build when /etc/malloc.conf -> AJ

    http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/sed/compile.c#rev1.8 Terminate our output string correctly if we've got an ``a'' command that has an escaped newline on the last line of the last script that we're processing.

    http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/sed/compile.c#rev1.34 NUL-terminate buffer in compiler_text() after realloc, not before. Now that we have dynamically sized buffers there may not be room for the NUL until after realloc.

    → <<cset 4288fbb8deb5>>

  2. Log in to comment