| delorie.com/archives/browse.cgi | search | 
| X-Recipient: | archive-cygwin AT delorie DOT com | 
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id | 
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=TDKcLtEYiia4s7YYzf685mHjRWAbcTeeql28M3HN3uosMm4oGPXEd | |
| Y4izyccgtQjGX6+FTKQOmTG66Y94HUrDpDsL5kTVj0WqZzByyGIPVI/XfrpS2iI/ | |
| LW3Y2m8fSXQONFXYbLhrHjkJ2oHnPLbCHG1Jg8oL0ejfsD1zYksO08= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id | 
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=RJmSiRKgeqvzSuxSHXMUBeMWKKQ=; b=Jl55P05b/zbAA+uXaR09z2uHoSxT | |
| yMeLi10DiZdmKh36XztQ8xz1E7nb5PDP53FkLwAww9FeyPPgztK7g/0cPiEvfBZO | |
| jRDamHZXUZW8FdFfXUJek6HwoiFFk5MKPTShtpm6tY6nk3bb0xkNwckk/TRQOJoE | |
| 5bSriE0MSojZV6U= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm | 
| List-Id: | <cygwin.cygwin.com> | 
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> | 
| List-Archive: | <http://sourceware.org/ml/cygwin/> | 
| List-Post: | <mailto:cygwin AT cygwin DOT com> | 
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> | 
| Sender: | cygwin-owner AT cygwin DOT com | 
| Mail-Followup-To: | cygwin AT cygwin DOT com | 
| Delivered-To: | mailing list cygwin AT cygwin DOT com | 
| 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 | 
| Date: | Thu, 23 Apr 2015 15:24:20 +0200 | 
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> | 
| To: | cygwin AT cygwin DOT com | 
| Subject: | Re: Deleting files with open handles on subst'd drives | 
| Message-ID: | <20150423132420.GL3657@calimero.vinschen.de> | 
| Reply-To: | cygwin AT cygwin DOT com | 
| Mail-Followup-To: | cygwin AT cygwin DOT com | 
| References: | <55383264 DOT 5020205 AT gmail DOT com> <20150423081515 DOT GF3657 AT calimero DOT vinschen DOT de> | 
| MIME-Version: | 1.0 | 
| In-Reply-To: | <20150423081515.GF3657@calimero.vinschen.de> | 
| User-Agent: | Mutt/1.5.23 (2014-03-12) | 
--UXdImcDs+Jp8Skh3
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
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; } <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: <https:/=
/gist.github.com/elieux/6463521192baed613099>
> >=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
-----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--
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |