sed(1) a/c/i command line continuation bug
the bug originaly reported by Keith Bostic via Kirk McKusick, and already fixed for more than 20years ago.
-
FreeBSD https://svnweb.freebsd.org/base?view=revision&revision=16510
Fix from Keith Bostic bostic@bsdi.com for bug in sed dealing with continuation lines.
Submitted by: Keith Bostic via Kirk McKusick
-
OpenBSD http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/sed/compile.c#rev1.4
fix for a line continuation bug, more than a year ald. work by mckusick, bostic, mark@linus.demon.co.uk, davidg, and bde.
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)
-
reporter -
reporter - changed status to resolved
done.
-
reporter BUGFIX: Issue
#125-- fix line continuation bug, other *BSD fixed it more than 20 years ago.- FreeBSD's commit log:
https://svnweb.freebsd.org/base?view=revision&revision=16510 Fix from Keith Bostic bostic@bsdi.com for bug in sed dealing with continuation lines.
Submitted by: Keith Bostic via Kirk McKusick
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
- OpenBSD's commit log:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/sed/compile.c#rev1.4 fix for a line continuation bug, more than a year ald. work by mckusick, bostic, mark@linus.demon.co.uk, davidg, and bde. patch taken from OpenBSD, see following commit:
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>>
- FreeBSD's commit log:
- Log in to comment
merged from F/O <<cset:cd0c55fc624948d2e559000acc4872ff551cf8e0>>.