From owner-freebsd-bugs Tue Jun 25 16:00:28 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA05323 for bugs-outgoing; Tue, 25 Jun 1996 16:00:28 -0700 (PDT) Received: from linus.demon.co.uk (linus.demon.co.uk [158.152.10.220]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id PAA04501; Tue, 25 Jun 1996 15:53:58 -0700 (PDT) Received: (from mark@localhost) by linus.demon.co.uk (8.7.5/8.7.3) id XAA07370; Tue, 25 Jun 1996 23:52:19 GMT Message-Id: <199606252352.XAA07370@linus.demon.co.uk> From: mark@linus.demon.co.uk (Mark Valentine) Date: Tue, 25 Jun 1996 23:52:18 +0000 In-Reply-To: Peter Mutsaers's message of Jun 25, 10:54pm X-Mailer: Mail User's Shell (7.2.6 alpha(3) 7/19/95) 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 Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > From: Peter Mutsaers > 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