From owner-freebsd-current@FreeBSD.ORG Fri Jul 6 14:34:39 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3546A16A46C for ; Fri, 6 Jul 2007 14:34:39 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [210.51.165.229]) by mx1.freebsd.org (Postfix) with ESMTP id E24E113C46C for ; Fri, 6 Jul 2007 14:34:38 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from localhost (tarsier.geekcn.org [210.51.165.229]) by tarsier.geekcn.org (Postfix) with ESMTP id 17CC9EB4F14; Fri, 6 Jul 2007 22:34:38 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([210.51.165.229]) by localhost (mail.geekcn.org [210.51.165.229]) (amavisd-new, port 10024) with ESMTP id acHfQ17FZssR; Fri, 6 Jul 2007 22:34:34 +0800 (CST) Received: from charlie.delphij.net (unknown [221.220.30.253]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTP id D6877EB47FA; Fri, 6 Jul 2007 22:34:33 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:user-agent:mime-version:to:cc:subject: references:in-reply-to:content-type; b=ft9EhzowONPyH8GcH7EDnu72/rFNPvKo7JGLtCbZPO1yWMNqTFTUF9p4PfKaMXz0b coW27fvnmbYIRDk4y/szQ== Message-ID: <468E52F8.2000501@delphij.net> Date: Fri, 06 Jul 2007 22:34:32 +0800 From: Xin LI User-Agent: Thunderbird 2.0.0.4 (X11/20070704) MIME-Version: 1.0 To: YAMAMOTO Shigeru References: <1183669505.10705.22.camel@patricia-laptop> <20070706.193428.212414018.shigeru@iij.ad.jp> In-Reply-To: <20070706.193428.212414018.shigeru@iij.ad.jp> Content-Type: multipart/mixed; boundary="------------070805060302040409020809" Cc: freebsd-current@freebsd.org, dogcube@gmail.com Subject: Re: buildworld error X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2007 14:34:39 -0000 This is a multi-part message in MIME format. --------------070805060302040409020809 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit YAMAMOTO Shigeru wrote: > Hi, all, > > I check a code to generate 'md2hl.c'. > I find 'sed' does not work right. > > I test following patterns. > % echo "abcdefg" | sed -e 's/abc/hij/g' > hijdefg > % echo "ABCDEFG" | sed -e 's/abc/hij/g' > hijDEFG > % echo "abcdefg" | sed -e 's/ABC/HIJ/g' > HIJdefg > % echo "ABCDEFG" | sed -e 's/ABC/HIJ/g' > HIJDEFG > > It seems me 'sed' always work with '/I'. > #'I' option is added at '2007/07/04 16:42:41'. > > Is it bug? I think so. Try attached patch. Cheers, --------------070805060302040409020809 Content-Type: text/x-patch; name="sed.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sed.diff" Index: compile.c =================================================================== RCS file: /home/ncvs/src/usr.bin/sed/compile.c,v retrieving revision 1.29 diff -u -p -r1.29 compile.c --- compile.c 4 Jul 2007 16:42:41 -0000 1.29 +++ compile.c 6 Jul 2007 07:00:47 -0000 @@ -318,19 +318,19 @@ nonsel: /* Now parse the command */ errx(1, "%lu: %s: substitute pattern can not be delimited by newline or backslash", linenum, fname); - if ((cmd->u.s = malloc(sizeof(struct s_subst))) == NULL) + if ((cmd->u.s = calloc(1, sizeof(struct s_subst))) == NULL) err(1, "malloc"); p = compile_delimited(p, re); if (p == NULL) errx(1, "%lu: %s: unterminated substitute pattern", linenum, fname); + --p; + p = compile_subst(p, cmd->u.s); + p = compile_flags(p, cmd->u.s); if (*re == '\0') cmd->u.s->re = NULL; else cmd->u.s->re = compile_re(re, cmd->u.s->icase); - --p; - p = compile_subst(p, cmd->u.s); - p = compile_flags(p, cmd->u.s); EATSPACE(); if (*p == ';') { p++; --------------070805060302040409020809--