This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in rm -r with locked files


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@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]