Subject: Re: search and replace tool
From: Brian Dessent <[email-masked]>
To: [email-masked]
Date: Fri, 20 Feb 2004 00:00:58 -0800

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/