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 X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Wed, 22 Jan 2003 12:34:31 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Randall R Schulz cc: cygwin AT cygwin DOT com Subject: Re: Bug in rm -r with locked files In-Reply-To: <5.2.0.9.2.20030122090107.01ebe5a0@pop3.cris.com> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 22 Jan 2003, Randall R Schulz wrote: > 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 Randall, Yes, I realize that. I wasn't suggesting a fix for the problem, I was suggesting a workaround that would let people do what they want without having to traverse (apparently huge) trees twice. I agree that the problem exists and needs to be fixed (at some point, by someone who understands what's going on). Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk! -- /usr/games/fortune -- 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/