From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 30 18:07:47 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 0A93216A409 for ; Fri, 30 Mar 2007 18:07:47 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.freebsd.org (Postfix) with ESMTP id 1885213C4B0 for ; Fri, 30 Mar 2007 18:07:45 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.4) with ESMTP id l2UI6LmK005476; Fri, 30 Mar 2007 22:06:21 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.4/Submit) id l2UI6LQm005475; Fri, 30 Mar 2007 22:06:21 +0400 (MSD) (envelope-from yar) Date: Fri, 30 Mar 2007 22:06:20 +0400 From: Yar Tikhiy To: Diomidis Spinellis Message-ID: <20070330180620.GE98431@comp.chem.msu.su> References: <20070326135106.GG60831@comp.chem.msu.su> <460B76A0.5030200@aueb.gr> <20070330172133.GD98431@comp.chem.msu.su> <460D494E.3030106@aueb.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <460D494E.3030106@aueb.gr> User-Agent: Mutt/1.5.9i 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 18:07:47 -0000 On Fri, Mar 30, 2007 at 08:30:54PM +0300, Diomidis Spinellis wrote: > 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. Thanks! I hope I'll make a fix for both issues soon, it's in the works already. The issues appear related in the code. > 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. Thank you for pointing me out at the format! Sorry, I haven't looked at it yet, but I've noticed the tests going into the tree and remembered that I should pay attention to writing new regression tests and running the existing tests if I change sed. Of course, I'll use the standard format. -- Yar