Deletion race in NtSetFileInformation ? (Directory not empty error in rm -r -f)

Earl Chew
Tue Sep 14 18:47:00 GMT 2010

> There shouldn't be any race.  When you set the delete disposition,
> the file is actually deleted as soon as the last handle to the file
> is closed.  If the file isn't opened by another process, it will
> disappear right at the NtClose at the end of unlink_nt.  Please note
> that the call to check_dir_not_empty already takes place *only* if
> trying to open the directory failed with STATUS_SHARING_VIOLATION.
> So there *was* another process blocking things.


Yes, I noticed that check wrt STATUS_SHARING_VIOLATION.

These actions are performed consequential to a shell script,
that launches a Makefile, that performs the rm -r -f ... so within
that context there is definitely scope for oversight and we
might inadvertently have a process getting in the way.

When you describe the other process blocking things, what might
that other process be doing?

I presume that other process having the directory in question
open, or as cwd is sufficient.

Is there anything else I should be on the lookout for?


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list