Sed commands a,i,c are followed by lines of text, where newlines are escaped. Currently only one line can follow. The second line is interpreted like a new sed command. Fix: Remove revision 1.5 from compile.c This was supposed to fix a bug in dealing with continuation lines but somehow introduced this bug. How-To-Repeat: sed '1a\ hallo\ xxx ' Output: ": extra characters at the end of x command
> From: Peter Mutsaers <plm@xs4all.nl> > Date: Tue 25 Jun, 1996 > Subject: bin/1350: sed bug > Remove revision 1.5 from compile.c > This was supposed to fix a bug in dealing with continuation lines > but somehow introduced this bug. My old patch attached to the (now closed) PR bin/908 fixes the original problem without introducing the new one. (There was a reason I chose the somewhat inelegant writing of '\0' into lbuf rather than do it properly with a new flag variable like Keith tried to do - it meant a textually smaller change which I had a better chance of understanding!) I'm too lazy to repeat the minor edits it took me to get the regression tests running in December, and the test suite showed some signs of bit rot, so I didn't go to the bother of writing a case to test for the bug reported in bin/908... Here's the (slightly bigger now) version of my patch against the new compile.c (the original was a 10 character edit): --- compile.c.ctm Wed Jun 19 21:42:20 1996 +++ compile.c Tue Jun 25 23:24:17 1996 @@ -615,7 +615,7 @@ static char * compile_text() { - int asize, esc_nl, size; + int asize, size; char *text, *p, *op, *s; char lbuf[_POSIX2_LINE_MAX + 1]; @@ -626,15 +626,13 @@ op = s = text + size; p = lbuf; EATSPACE(); - for (esc_nl = 0; *p != '\0'; p++) { - if (*p == '\\' && *p++ == '\0') { - esc_nl = 1; - break; - } + for (; *p != '\0'; p++) { + if (*p == '\\') + *p++ = '\0'; *s++ = *p; } size += s - op; - if (!esc_nl) { + if (p[-2] != '\0') { *s = '\0'; break; } Mark. -- Mark Valentine at Home <mailto:mv@pobox.com> <http://www.pobox.com/~mv/>
State Changed From-To: open->closed should be fixed in compile.c, revision 1.7
Responsible Changed From-To: freebsd-bugs->bde