Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 1 Jul 2002 13:12:32 +0800 From: Greg Matheson To: cygwin AT cygwin DOT com Subject: Re: perl and problem with in-place edits (just deletes files) on Cygwin 1.3.10 on Win98 Message-ID: <20020701131231.C78450@ms.chinmin.edu.tw> Mail-Followup-To: cygwin AT cygwin DOT com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i On Thu, 27 Jun 2002, Max wrote: > Ran this command the other day in a directory with C files > perl -p -i -e 's/string1/string2/g' *c > Got a long list of > Can't do inplace edit on name.c: File exists. > At the end of it, all the .c files were deleted According to this thread, perl opens the file for reading in place, unlinks it (the unlink is queued by cygwin), opens a same name file for writing, gets a Windows error message that file exists, and so can't write and the operation is canceled. The unlink is not canceled however, and so the file is deleted. http://sources.redhat.com/ml/cygwin/2001-08/msg00404.html -- Greg Matheson Teaching: computer programming Chinmin College done by monkeys. Taiwan Penpals Archive -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/