Date: Tue, 25 Jun 1996 23:52:18 +0000 From: mark@linus.demon.co.uk (Mark Valentine) To: plm@xs4all.nl, freebsd-bugs@freefall.freebsd.org, FreeBSD-gnats-submit@freebsd.org, gnats@freefall.freebsd.org (GNATS Management) Subject: Re: bin/1350: sed bug Message-ID: <199606252352.XAA07370@linus.demon.co.uk> In-Reply-To: Peter Mutsaers's message of Jun 25, 10:54pm
next in thread | raw e-mail | index | archive | help
> 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/>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606252352.XAA07370>