delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/22/12:12:23

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: <5.2.0.9.2.20030122090107.01ebe5a0@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Wed, 22 Jan 2003 09:08:46 -0800
To: cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: Bug in rm -r with locked files
In-Reply-To: <Pine.GSO.4.44.0301221139220.23429-100000@slinky.cs.nyu.edu
>
References: <3E2E5EEA DOT 3000606 AT polyspace DOT com>
Mime-Version: 1.0

At 08:44 2003-01-22, Igor Pechtchanski wrote:
>On Wed, 22 Jan 2003, Gael Mulat wrote:
>
> >     OK. If I summurize all that has been said, this problem is
> > well-known but has no solution in a near future.
> >
> >     But a workaround would be very useful for people (me and Brian
> > Kelly, for instance) who use plenty of rm -rf in cross-platform shell
> > scripts.
> >
> >     Thanks to Shankar Unni, I have mine: I didn't noticed that only rm
> > -rf had the trouble, and not rm -r.
> >
> >     So my workaround will be to replace all the '/bin/rm -rf dir' by
> > 'chmod -R +w dir; /bin/rm -r dir'. The semantic is not exactly the same
> > (especially on write-protected directories), but that will allow my
> > scripts to work well...
> >
> >     Thanks everybody.
> > Gael.
>
>A suggestion:
>
>'/bin/find dir -depth -exec /bin/chmod +w {} \; -exec /bin/rm -r {} \;'
>might work, and will only parse the tree once...  It will invoke chmod and
>rm multiple times, though, but that's a tradeoff.
>     Igor


Igor,

I think we've drifted off the problem here. This isn't a issue of file 
modes interfering with file removal, its an interaction with window's 
"locking" of files that are in-use (open).

And as the discussion from last April showed, not all in-use states 
interfered with removal via Cygwin unlink(). While we were having 
trouble getting my original problem reproduced, I decided to write a 
Java program that opened a file and kept it open. Something about the 
way Java opened files triggered the problem where not all other uses did.

Perhaps it was just a Cygwin (non-interfering) vs. non-Cygwin 
(interfering) use of the file. I don't know. I don't know what was the 
exact diagnosis of the problem at the level of the Cygwin unlink code.

Chris January might know.

Randall Schulz 


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

- Raw text -


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