From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 30 17:31:17 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5A4C816A400 for ; Fri, 30 Mar 2007 17:31:17 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-out.forthnet.gr (mx-out.forthnet.gr [193.92.150.103]) by mx1.freebsd.org (Postfix) with ESMTP id CFC9213C4CC for ; Fri, 30 Mar 2007 17:31:16 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-av-02.forthnet.gr (mx-av.forthnet.gr [193.92.150.27]) by mx-out-02.forthnet.gr (8.14.0/8.14.0) with ESMTP id l2UHVF2F015378; Fri, 30 Mar 2007 20:31:15 +0300 Received: from MX-IN-01.forthnet.gr (mx-in-01.forthnet.gr [193.92.150.23]) by mx-av-02.forthnet.gr (8.13.7/8.13.7) with ESMTP id l2UHVFtJ005711; Fri, 30 Mar 2007 20:31:15 +0300 Received: from [192.168.136.22] (ppp121-127.adsl.forthnet.gr [193.92.228.127]) by MX-IN-01.forthnet.gr (8.14.0/8.14.0) with ESMTP id l2UHV6HF002136; Fri, 30 Mar 2007 20:31:07 +0300 Authentication-Results: MX-IN-01.forthnet.gr from=dds@aueb.gr; sender-id=neutral; spf=neutral Message-ID: <460D494E.3030106@aueb.gr> Date: Fri, 30 Mar 2007 20:30:54 +0300 From: Diomidis Spinellis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061211 SeaMonkey/1.0.7 MIME-Version: 1.0 To: Yar Tikhiy References: <20070326135106.GG60831@comp.chem.msu.su> <460B76A0.5030200@aueb.gr> <20070330172133.GD98431@comp.chem.msu.su> In-Reply-To: <20070330172133.GD98431@comp.chem.msu.su> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org Subject: Re: sed -i X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Mar 2007 17:31:17 -0000 Yar Tikhiy wrote: > May I take a bit more of your time? > > I've started playing with the code and noticed another gray area. > Namely a `c' command won't print the text if having 2 addresses > with the 2nd address beyond the actual end of file. For example: > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BEGIN > $ jot 9 | >> sed '6,15c\ >> text >> ' test > 1 > 2 > 3 > 4 > 5 > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END > > Ditto with RE's, if the 2nd RE doesn't match any line: > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BEGIN > $ jot 9 | sed '/6/,/15/c\ >> text >> ' test > 1 > 2 > 3 > 4 > 5 > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END > > If we've started to delete the pattern space, we should print the > text in place of it because `c' is for `change'. BSD and GNU seds > have this bug, but Solaris sed doesn't have it. Do you think we > should fix it, too? > > Thanks! > Yes, it sounds like a bug to me. Note that a couple of weeks ago I added the regression tests I originally wrote in 1992 to the FreeBSD regression test suite. Given that you are writing test cases it would be very nice to follow the format used in src/tools/regression/usr.bin/sed/regress.t, so that we can add them to the test suite. Diomidis