From owner-freebsd-bugs Wed Jun 26 15:10:14 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id PAA21774 for bugs-outgoing; Wed, 26 Jun 1996 15:10:14 -0700 (PDT) Received: from mongoose.bostic.com (bostic@mongoose.BSDI.COM [205.230.230.129]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id PAA21736; Wed, 26 Jun 1996 15:10:07 -0700 (PDT) Received: (from bostic@localhost) by mongoose.bostic.com (8.7.4/8.7.3) id SAA11327; Wed, 26 Jun 1996 18:01:16 -0400 (EDT) Date: Wed, 26 Jun 1996 18:01:16 -0400 (EDT) From: Keith Bostic Message-Id: <199606262201.SAA11327@mongoose.bostic.com> To: mark@linus.demon.co.uk Subject: Re: New bug introduced with sed bugfix Cc: freebsd-bugs@freefall.freebsd.org, FreeBSD-gnats-submit@freebsd.org, gnats@freefall.freebsd.org, mckusick@McKusick.COM, plm@xs4all.nl Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >> 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. We discovered that the change wasn't right when we were reviewing my change internally -- I apologize for not forwarding a message when we found it! Here's the change that we ended up making. I won't swear that it's right, but it hasn't broken yet. ;-} --keith =================================================================== RCS file: /master/usr.bin/sed/compile.c,v retrieving revision 2.3 retrieving revision 2.4 diff -c -r2.3 -r2.4 *** compile.c 1996/06/03 21:25:33 2.3 --- compile.c 1996/06/26 22:03:21 2.4 *************** *** 1,4 **** ! /* BSDI $Id: compile.c,v 2.3 1996/06/03 21:25:33 bostic Exp $ */ /*- * Copyright (c) 1992 Diomidis Spinellis. --- 1,4 ---- ! /* BSDI $Id: compile.c,v 2.4 1996/06/26 22:03:21 bostic Exp $ */ /*- * Copyright (c) 1992 Diomidis Spinellis. *************** *** 595,601 **** static char * compile_text() { ! int asize, size; char *text, *p, *op, *s; char lbuf[_POSIX2_LINE_MAX + 1]; --- 595,601 ---- static char * compile_text() { ! int asize, esc_nl, size; char *text, *p, *op, *s; char lbuf[_POSIX2_LINE_MAX + 1]; *************** *** 606,618 **** op = s = text + size; p = lbuf; EATSPACE(); ! for (; *p; p++) { ! if (*p == '\\') ! p++; *s++ = *p; } size += s - op; ! if (p[-2] != '\\') { *s = '\0'; break; } --- 606,620 ---- op = s = text + size; p = lbuf; EATSPACE(); ! for (esc_nl = 0; *p != '\0'; p++) { ! if (*p == '\\' && *++p == '\0') { ! esc_nl = 1; ! break; ! } *s++ = *p; } size += s - op; ! if (!esc_nl) { *s = '\0'; break; }