From lizard@unsane.de  Thu Jun 20 14:00:53 2002
Return-Path: <lizard@unsane.de>
Received: from unsane.de (pD9E4EBDC.dip.t-dialin.net [217.228.235.220])
	by hub.freebsd.org (Postfix) with ESMTP id A7BCA37B421
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 20 Jun 2002 14:00:29 -0700 (PDT)
Received: from localhost (localhost.unsane.de [127.0.0.1])
	by unsane.de (Postfix) with ESMTP id A3DAE29D
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 20 Jun 2002 23:00:27 +0200 (CEST)
Received: by unsane.de (Postfix, from userid 1001)
	id DBB72263; Thu, 20 Jun 2002 23:00:26 +0200 (CEST)
Message-Id: <20020620210026.DBB72263@unsane.de>
Date: Thu, 20 Jun 2002 23:00:26 +0200 (CEST)
From: Oliver Braun <obraun@informatik.unibw-muenchen.de>
Reply-To:
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sed -i -e '[...]' file saves backup file with extension -e
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         39599
>Category:       bin
>Synopsis:       sed -i -e '[...]' file saves backup file with extension -e
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 20 14:10:01 PDT 2002
>Closed-Date:    Thu Jun 20 18:06:59 EDT 2002
>Last-Modified:  Thu Jun 20 15:10:01 PDT 2002
>Originator:     Oliver Braun
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:
System: FreeBSD galore.unsane.de 4.6-STABLE FreeBSD 4.6-STABLE #0: Sun Jun 16 12:43:32 CEST 2002 root@galore.unsane.de:/usr/obj/usr/src/sys/GALORE_OB i386


>Description:

If sed(1) is called with -i flag without an extension the following characters
will be used as extension. man sed says: If a zero-length extension is given,
no backup will be saved.

Regards,
         Olli

>How-To-Repeat:

use sed on -current or sed_inplace on -stable.

touch test
sed -i -e 's/foo/bar/' test
ls

>Fix:

N/A
>Release-Note:
>Audit-Trail:

From: Matthew Hunt <mph@astro.caltech.edu>
To: Oliver Braun <obraun@informatik.unibw-muenchen.de>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/39599: sed -i -e '[...]' file saves backup file with extension -e
Date: Thu, 20 Jun 2002 14:29:17 -0700

 On Thu, Jun 20, 2002 at 11:00:26PM +0200, Oliver Braun wrote:
 
 > If sed(1) is called with -i flag without an extension the following characters
 > will be used as extension. man sed says: If a zero-length extension is given,
 > no backup will be saved.
 
 I think you actually need to provide the zero-length extension:
 
 sed -i "" -e 's/foo/bar/g' filename
 
 -- 
 Matthew Hunt <mph@astro.caltech.edu> * Clearly there are more things in the
 http://www.pobox.com/~mph/           * heavens than anyone anticipated. -enp
State-Changed-From-To: open->closed 
State-Changed-By: mph 
State-Changed-When: Thu Jun 20 18:06:13 EDT 2002 
State-Changed-Why:  
It was not clear to the submitter that "zero-length extension" means 
that an extension of "" is required, vs. a missing argument. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39599 

From: Oliver Braun <obraun@informatik.unibw-muenchen.de>
To: Matthew Hunt <mph@astro.caltech.edu>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/39599: sed -i -e '[...]' file saves backup file with extension -e
Date: Thu, 20 Jun 2002 23:35:59 +0200

 * Matthew Hunt <mph@astro.caltech.edu> [2002-06-20 23:30]:
 > On Thu, Jun 20, 2002 at 11:00:26PM +0200, Oliver Braun wrote:
 
 > > If sed(1) is called with -i flag without an extension the following characters
 > > will be used as extension. man sed says: If a zero-length extension is given,
 > > no backup will be saved.
 
 > I think you actually need to provide the zero-length extension:
 > sed -i "" -e 's/foo/bar/g' filename
 
 OK. I see. I think I have missunderstood the manpage. I assumed that a
 zero-length extension == no extension.
 
 => This PR can be closed.
 
 Regards,
          Olli
>Unformatted:
