Unable to delete directory in Cygwin

Lev Bishop lev.bishop@gmail.com
Tue Jun 20 15:28:00 GMT 2006


On 6/19/06, mwoehlke  wrote:
> Larry Hall (Cygwin) wrote:
> > mwoehlke wrote:
> >> Eric Blake wrote:
> >>> That said, cygwin does try to emulate linux, and if someone were to
> >>> contribute a patch that would allow cygwin to emulate directory deletion
> >>> if it knows that all open handles have also been scheduled for unlinking
> >>> at process end, then http://cygwin.com/acronyms/#PTC.
> >>
> >> Not a patch, but for the record, it looks like Interix solves this
> >> problem (http://www.interopsystems.com/tools/tm.aspx?m=9403). Maybe
> >> Cygwin could do something similar?
> >>
> >> (And in case that link dies; apparently Interix has a special 'temp'
> >> directory where "unlinked" files are sent until their handles are all
> >> closed.)
> >
> > If you take a look at the cygwin sources, you'll see that Cygwin does
> > something similar already.  This does not solve the problem for those
> > that want to unlink and immediately recreate the unlinked entry though...
>
> I'm confused. As I read the post, if I create a file 'bar' in '/foo',
> open the file, and then 'rm -rf /foo', I can't do that. If Cygwin
> "magically redirects" 'bar' to some special place, wouldn't that
> a: allow me to unlink '/foo'
> b: allow me to then create a new (and different) '/foo/bar'?

Yes, in both cases. However, cygwin doesn't do this magic redirection.
What it does do, as far as I understand it, is that it adds files that
have deletion syscalls called on them to a pending-deletion list,
returns success to the deleter, and then deletes the file at the first
chance it gets. I had a go at making a "magic redirection" patch a
while ago, but never got it into submittable form.

> I also do not see anywhere that the OP is even trying to do [b].

With the current cygwin, you don't get that far, since the file bar
still exists until it's no longer in use, and the pending-delete stuff
doesn't happen for directories.

Take a look at winsup/cygwin/delqueue.cc , especially the initial
FIXME comment....

L

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



More information about the Cygwin mailing list