delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/20/04:46:21

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <4035D75B.3020909@corpit.ru>
Date: Fri, 20 Feb 2004 12:46:03 +0300
From: Egor Duda <deo AT corpit DOT ru>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040122 Debian/1.6-1
MIME-Version: 1.0
To: Yitzchak Scott-Thoennes <sthoenna AT efn DOT org>
Cc: cygwin AT cygwin DOT com
Subject: Re: search and replace tool
References: <291592011 DOT 20040218205953 AT thequod DOT de> <6 DOT 0 DOT 1 DOT 1 DOT 0 DOT 20040218151724 DOT 0398d488 AT 127 DOT 0 DOT 0 DOT 1> <40354B21 DOT 6040802 AT x-ray DOT at> <Pine DOT GSO DOT 4 DOT 56 DOT 0402191929000 DOT 22216 AT slinky DOT cs DOT nyu DOT edu> <40355763 DOT E01A2710 AT dessent DOT net> <Pine DOT GSO DOT 4 DOT 56 DOT 0402191952150 DOT 22216 AT slinky DOT cs DOT nyu DOT edu> <4035B0EB DOT 50003 AT corpit DOT ru> <20040220075109 DOT GA132 AT efn DOT org>
In-Reply-To: <20040220075109.GA132@efn.org>
X-IsSubscribed: yes
Note-from-DJ: This may be spam

Yitzchak Scott-Thoennes wrote:
> On Fri, Feb 20, 2004 at 10:02:03AM +0300, 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.
>>
>>deo AT paltus:~$ echo aaa >xxx
>>deo AT paltus:~$ ls -i xxx
>> 408096 xxx
>>deo AT paltus:~$ perl -i -pe 's/aaa/bbbb/' xxx
>>deo AT paltus:~$ ls -i xxx
>> 408074 xxx
>>deo AT paltus:~$ cat xxx
>>bbbb
> 
> 
> That doesn't ever create a backup file or a temporary file.  It opens
> xxx for read, unlinks it, opens xxx for writing, then reads from the
> original handle and writes to the second handle.  This is AFAIUI
> impossible on windows, but possible on things like unix and VMS (where
> the unlink is skipped because of the automatic versioning).

Well, it creates new file, while old one is still present on disk. Space 
occupied by original file is freed only after handle is closed. What is 
deleted immediatly on linux is just directory entry, not the file itself.

Depending on the goal you wish to achive, cygwin may have drawbacks 
compared to linux or they may be equal.

If you want to search-and-replace in 700Mb file on 1Gb disk then you 
won't be able to do so either on linux or on cygwin.
If you wish to keep your real .bak file from being overwritten by 
search-and-replace script, then linux is slightly more convenient here, 
but on cygwin it's almost as easy to work around.

egor.

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019