Date: Wed, 26 Jun 1996 18:01:16 -0400 (EDT) From: Keith Bostic <bostic@bsdi.com> To: mark@linus.demon.co.uk Cc: freebsd-bugs@freefall.freebsd.org, FreeBSD-gnats-submit@freebsd.org, gnats@freefall.freebsd.org, mckusick@McKusick.COM, plm@xs4all.nl Subject: Re: New bug introduced with sed bugfix Message-ID: <199606262201.SAA11327@mongoose.bostic.com>
index | next in thread | raw e-mail
>> 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;
}
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606262201.SAA11327>
