From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95001 invoked by alias); 23 Apr 2015 13:24:25 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 94906 invoked by uid 89); 23 Apr 2015 13:24:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: calimero.vinschen.de Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Apr 2015 13:24:23 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 0107BA80973; Thu, 23 Apr 2015 15:24:21 +0200 (CEST) Date: Thu, 23 Apr 2015 13:24:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Deleting files with open handles on subst'd drives Message-ID: <20150423132420.GL3657@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <55383264.5020205@gmail.com> <20150423081515.GF3657@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UXdImcDs+Jp8Skh3" Content-Disposition: inline In-Reply-To: <20150423081515.GF3657@calimero.vinschen.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-04/txt/msg00545.txt.bz2 --UXdImcDs+Jp8Skh3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2137 On Apr 23 10:15, Corinna Vinschen wrote: > On Apr 23 01:44, David Macek wrote: > > Hello everyone. > >=20 > > Some time ago, I encountered a problem in a script when run on Cygwin/M= SYS2. To add some drama, I'll mention that the problem caused some data los= s (nothing important though). The problem is that some operations on open f= iles seem to fail on subst'd drives (but not on regular ones). > >=20 > > To reproduce the problem, choose some writable directory and run: > > $ subst X: C:/somesubdir > > $ cd /cygdrive/x/ > > $ touch foo > > $ { rm foo; touch foo; } > touch: cannot touch 'foo': Permission denied > >=20 > > (Do not subst to just C:/, because that somehow doesn't lead to the err= or.) > >=20 > > There's also a C program that does essentially the same thing: > >=20 > > 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). >=20 > It's a result of how Cygwin tries to workaround the weird Windows > behaviour that a deleted, but still opened file is not invisible in the > filesystem, as desired per POSIX. Cygwin then tries to move the > file out of the way, on local drives into the recycler. This fails > on a subst drive pointing to some subdir apparently, so Cygwin just > falls back to what Windows does. >=20 > I have no simple workaround for that. In theory there should be a > way to check the drive for being a virtual drive and then using the > recycler of the drive it's pointing to for the aforementioned operation. I hacked a bit on that and it seems the solution was easier than I thought. I uploaded new developer snaphshots to https://cygwin.com/snapshots/ Replacing the Cygwin DLL alone is sufficient for testing. Please give it a try. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --UXdImcDs+Jp8Skh3 Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVOPKEAAoJEPU2Bp2uRE+gVp4QAJk0peojYcl6Wvohs9SEkH42 orgAJzZottZBi6piqOs0+KZg/8JhhY2c1xfCbewVp2D6OVja5bb5UeV7KgP6q6oe v/A7YK/Cy3DFKxxNu0Bnvi6bVaplb/9b2EnIdtI5EwjxTCT/OtjFNI+caPOb4Qke Mg14mrL6BTsEhXGqRuPz4ESOIlh9sAabq6PUkvxp/C3zCEWOmjWMccbcrYpNAetb 5A9EJ/Y3ZhBp8LNYIPpxc310R8bdZKP0973DzVj9CHe19khlRCB+/ki87hfc+Hd9 pLj0+FgpBnm0WWNoj3m58hIrA3kqptNDdifngeC/FekelfiDRQK3YuzZht/TK8Jf wYM4JE1xam7CpzuWp2QyBeFKcL62X6+Xm9cIepoocTXrqSm/iyNY350jfT/vOXdD 80fhJ6MhPrfBXbe/GJWDURNAPJgSqbOpDh2FxURtr/Ntooyo9KdhhfSC/3SMty7l CVsIhh7cbpOJEdTolGV61cA7SuEGG7qu+Hx0si3cpLnnHyOC5TwlGY8JZXUhRAsa Sym6A4qxzJ+fscvENafiyVMmb6TBpy4kjRowgV0VLRwWLT53i9acVqRA1opoGlAi ZdK2O1z85I6W7waxHmJqO/Vzdnki5EgJt5tihXujPVX3l3QbCRE0mCfL2U/Z/Cj3 Chrcvyi0Uyb1vpTvDS+O =uMQ/ -----END PGP SIGNATURE----- --UXdImcDs+Jp8Skh3--