Date: Sat, 27 Jul 2002 23:36:48 +0200 From: Cyrille Lefevre <cyrille.lefevre@laposte.net> To: Dan Nelson <dnelson@allantgroup.com> Cc: Tony Finch <dot@dotat.at>, 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> In-Reply-To: <20020727201824.GB16128@dan.emsphone.com> References: <20020726165021.C7551@chiark.greenend.org.uk> <20020727051224.GA7996@gits.dyndns.org> <20020727201824.GB16128@dan.emsphone.com>
index | next in thread | previous in thread | raw e-mail
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
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020727213648.GA93121>
