From owner-freebsd-hackers Sat Jul 27 14:36:58 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B710637B400 for ; Sat, 27 Jul 2002 14:36:54 -0700 (PDT) Received: from smtp.noos.fr (claudel.noos.net [212.198.2.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id A76B343E4A for ; Sat, 27 Jul 2002 14:36:53 -0700 (PDT) (envelope-from cyrille.lefevre@laposte.net) Received: (qmail 35493168 invoked by uid 0); 27 Jul 2002 21:36:52 -0000 Received: from unknown (HELO gits.gits.dyndns.org) ([212.198.229.153]) (envelope-sender ) by 212.198.2.83 (qmail-ldap-1.03) with SMTP for ; 27 Jul 2002 21:36:52 -0000 Received: from gits.gits.fr.invalid (vf1lr46tafjjs9cc@localhost [127.0.0.1]) by gits.gits.dyndns.org (8.12.5/8.12.5) with ESMTP id g6RLaqNc093201 for ; Sat, 27 Jul 2002 23:36:52 +0200 (CEST) (envelope-from cyrille.lefevre@laposte.net) Date: Sat, 27 Jul 2002 23:36:48 +0200 To: Dan Nelson Cc: Tony Finch , freebsd-hackers@FreeBSD.ORG, freebsd-ports@FreeBSD.ORG Subject: Re: sed -i has difficulty with read-only files Message-ID: <20020727213648.GA93121@gits.dyndns.org> References: <20020726165021.C7551@chiark.greenend.org.uk> <20020727051224.GA7996@gits.dyndns.org> <20020727201824.GB16128@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020727201824.GB16128@dan.emsphone.com> User-Agent: Mutt/1.3.99i Organization: ACME X-Face: V|+c;4!|B?E%BE^{E6);aI.[< Mail-Followup-To: cyrille.lefevre+dated+1028237810.0fe279@laposte.net, dnelson@allantgroup.com, dot@dotat.at, freebsd-hackers@FreeBSD.ORG, freebsd-ports@FreeBSD.ORG X-Delivery-Agent: TMDA/0.58 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Jul 27, 2002 at 03:18:24PM -0500, Dan Nelson wrote: > In the last episode (Jul 27), Cyrille Lefevre said: > > IMHO, both the old and the newer code are wrong. they should use > > getenv("TMPDIR") if any and certainly not the current directory. > > there is probably more room in ${TMPDIR:-/var/tmp} then in the > > current directory. imagine that the current fs is nearly full... > > Don't you want to temp filename to be in exactly the same place as the > original file, so the rename() swap will work? If the current fs is > full, then sed -i will fail anyway. currently, "sed -i '' ..." shouldn't fail (except if /tmp is too small) where "sed -i .bak ..." will. the proposed patch prevent inplace editing even when a backup file isn't asked. Cyrille. -- Cyrille Lefevre mailto:cyrille.lefevre@laposte.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message