Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <4035BEBA.BA2A9CC4@dessent.net>
Date: Fri, 20 Feb 2004 00:00:58 -0800
From: Brian Dessent <brian@dessent.net>
Organization: My own little world...
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: search and replace tool
References: <291592011.20040218205953@thequod.de> <6.0.1.1.0.20040218151724.0398d488@127.0.0.1> <40354B21.6040802@x-ray.at> <Pine.GSO.4.56.0402191929000.22216@slinky.cs.nyu.edu> <40355763.E01A2710@dessent.net> <Pine.GSO.4.56.0402191952150.22216@slinky.cs.nyu.edu> <4035B0EB.50003@corpit.ru>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Reply-To: cygwin@cygwin.com

Egor Duda wrote:

> huh? what do you mean "in-place"? linux writes new file to new place, it
> just deletes .bak file afterwards, unlike cygwin.

Okay, it's not technically in-place.  But perl expects to be able to do
the following if you specify "-i":

x = open("file");
unlink("file");
y = open("file");
read(x, ...);
write(y, ...);

When the program ends or the filehandles are closed, there's no further
action required, such as removing the backup copy, because it's already
been unlinked.

Unlinking an open file is not supported by the windows filesystem (?) so
this sequence is impossible.  To emulate this with Cygwin, new code
would have to be added that gets called after fh 'x' is closed to remove
the backup copy.  I'm no expert on perl internals but it sounds like
this has never been done because it's nontrivial.

That's all I know.  I think Gerrit would be able to comment further on
this.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

