public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Deleting files with open handles on subst'd drives
@ 2015-04-22 23:45 David Macek
  2015-04-23  8:15 ` Corinna Vinschen
  0 siblings, 1 reply; 9+ messages in thread
From: David Macek @ 2015-04-22 23:45 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]

Hello everyone.

Some time ago, I encountered a problem in a script when run on Cygwin/MSYS2. To add some drama, I'll mention that the problem caused some data loss (nothing important though). The problem is that some operations on open files seem to fail on subst'd drives (but not on regular ones).

To reproduce the problem, choose some writable directory and run:
$ subst X: C:/somesubdir
$ cd /cygdrive/x/
$ touch foo
$ { rm foo; touch foo; } <foo
touch: cannot touch 'foo': Permission denied

(Do not subst to just C:/, because that somehow doesn't lead to the error.)

There's also a C program that does essentially the same thing: <https://gist.github.com/elieux/6463521192baed613099>

I compared this with the same operations running on a regular drive, but I couldn't find any difference in how `rm` deletes the file nor in how `touch` creates the file. Just the result of the last NtCreateFile is different (STATUS_SUCCESS vs. STATUS_DELETE_PENDING).

Thoughts?

-- 
David Macek


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4234 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-04-24 11:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22 23:45 Deleting files with open handles on subst'd drives David Macek
2015-04-23  8:15 ` Corinna Vinschen
2015-04-23 13:24   ` Corinna Vinschen
2015-04-23 13:25     ` Nick Hansen
2015-04-23 14:32       ` David Macek
2015-04-23 14:36         ` Nick Hansen
2015-04-23 14:56           ` Eric Blake
2015-04-24  1:52     ` David Macek
2015-04-24 11:11       ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).