From owner-freebsd-standards@FreeBSD.ORG Tue Jun 3 18:35:38 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 97ECA37B404 for ; Tue, 3 Jun 2003 18:35:38 -0700 (PDT) Received: from smtp01.syd.iprimus.net.au (smtp01.syd.iprimus.net.au [210.50.30.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id D3A4D43F3F for ; Tue, 3 Jun 2003 18:35:37 -0700 (PDT) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au (203.134.172.104) by smtp01.syd.iprimus.net.au (7.0.015) id 3EDD491800000F38; Wed, 4 Jun 2003 11:35:18 +1000 Received: by dilbert.robbins.dropbear.id.au (Postfix, from userid 1000) id 790ACC90F; Wed, 4 Jun 2003 11:32:29 +1000 (EST) Date: Wed, 4 Jun 2003 11:32:29 +1000 From: Tim Robbins To: Tony Finch Message-ID: <20030604113229.A41800@dilbert.robbins.dropbear.id.au> References: <20030603144225.GH18938@chiark.greenend.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030603144225.GH18938@chiark.greenend.org.uk>; from dot@dotat.at on Tue, Jun 03, 2003 at 03:42:25PM +0100 cc: freebsd-standards@freebsd.org Subject: Re: Sed substitution bugs X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jun 2003 01:35:39 -0000 On Tue, Jun 03, 2003 at 03:42:25PM +0100, Tony Finch wrote: > $ echo foo | sed 's/ */,/g' > ,f,o,o > $ > > On Solaris and Linux I get ,f,o,o, (which is what I expected). It looks like I may have introduced this bug when I made the semi-dramatic change of making 'sed' not store newlines in the line buffers -- OpenBSD's sed gives the right result. I agree that the current output is wrong and that it should be ",f,o,o,". FWIW, 7th Edition sed gets into an infinite loop on that input. > The following work correctly: > > $ echo | sed 's/ */,/g' > , > $ echo foo | sed 's/ *$/,/g' > foo, > $ > > Here's another (related) bug: I can't claim responsibility for this one :-) But I agree that it looks like a bug. > > $ echo foo | sed 's/ */,/1' > ,foo > $ echo foo | sed 's/ */,/2' > ,foo > $ echo foo | sed 's/ */,/3' > ,foo > $ echo foo | sed 's/ */,/4' > ,foo > $ echo foo | sed 's/ */,/5' > ,foo > $ The patch looks fine, but it isn't obvious to me that the second part (handling the /nnn bits) is correct. It seems to produce the right output though. Tim