Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jun 2002 17:30:46 -0400 (EDT)
From:      Alexander Kabaev <ak03@gte.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        sobomax@FreeBSD.org, tjr@FreeBSD.org
Subject:   bin/39310: sed was broken in rev. 1.22 of main.c 
Message-ID:  <200206142130.g5ELUkQm087207@kanpc.gte.com>

next in thread | raw e-mail | index | archive | help


>Number:         39310
>Category:       bin
>Synopsis:       sed was broken in rev. 1.22 of main.c
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 14 14:40:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Kabaev
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD kanpc.gte.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Thu Jun 13 12:38:33 EDT 2002 root@kanpc.gte.com:/usr/obj/usr/src/sys/KANPC i386


	
>Description:
	The revision 1.22 commit resulted in sed 'N' function to broke.
	The N function tries to append data to the space and call mf_fgets
	to fetch the next line. mf_fgets function resets the space length
	to 0 for no reason, thus causing the previous content of the space
	to be overwritten instead of being appended to.
>How-To-Repeat:
	The following sed script from the teTex port does not work 
	as expected, causing the port build to fail:

        : again
        /\.$/{
                N
                s/\.\n/\
./
                t again
        }

>Fix:

Index: main.c
===================================================================
RCS file: /usr/ncvs/src/usr.bin/sed/main.c,v
retrieving revision 1.23
diff -u -r1.23 main.c
--- main.c	14 Jun 2002 02:20:05 -0000	1.23
+++ main.c	14 Jun 2002 21:20:48 -0000
@@ -315,7 +315,6 @@
 		firstfile = 1;
 	}
 
-	sp->len = 0;
 	for (;;) {
 		if (f != NULL && (c = getc(f)) != EOF) {
 			(void)ungetc(c, f);
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206142130.g5ELUkQm087207>