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=m6CWDUH8laLI+P2CTkKaTGMIMU0lMoYn6PPS/JgdM0jhGLodG1uhO LZhFcslpzqb2IAoain+3KMaNhXpGhjoSYxvzDA+qa1Z+N3RkrXVGX3iKRdnjQqOM YTRUmNSV7aNn2ORaoCEGD8TqVlURMKqVP0C3h4qH1Ombw9F76UN93k= 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=rDry6xgotruR4TDkAZsDnqZOEPo=; b=Fu6vVknAxAZQcBuj9WVsVuPyxzvW 9GEVIE6OKlyGB9sD6HELvlVm2rJem0vpm61I6tdNG+vrE5ld0yotYcE4iW57dTu0 mosoKFDbXfZe6F+aQoGjkL944SXD1Y1ksWBcrmvXHgkdj8nnpD2Hq7ytje58mtMG PgcQt8s0aMFFaUc= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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 10:15:15 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Deleting files with open handles on subst'd drives Message-ID: <20150423081515.GF3657@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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yQ6PUHtvLgXN2OhJ" Content-Disposition: inline In-Reply-To: <55383264.5020205@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) --yQ6PUHtvLgXN2OhJ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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/MSY= S2. 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 fil= es 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 error= .) >=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). 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. 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. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --yQ6PUHtvLgXN2OhJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVOKoTAAoJEPU2Bp2uRE+g/p0P/jOBXfvaDYg8Tgj1DyeSXohV R6RmZ1CwESYyIMSxCfvAGk01eNag4G07RzFMAT9akS2+wi9WQrh2FS60blnC15+V 5QVAP0FwZah4YJqe4OO/Dlfi3iMuoIWy/7O7Xigg5TpTKgfh6QxxQLB3f44N8+11 uklPjEPiPlxMm3Bwe52/wYdwmzU62elZ3VR+Aj33thcbU1f9QTfwGX/PaYLahB6Z q3n8ntDaJYB0CJjxR3wi6wg7dR0Pgd1Rm69F9hejc8fQt/xzHw9fPeJNf1NwTsOy B+DTuroCsRRkqwyRsk1JzdQ3A8iEpHkRYtVWQ4AAAGG23bxTcKcHpk/17XUf9icF 8rjTEEk9/GKatfE2xYQiphdof50NNgbwoosumgBGoRj1bgvPK+qKtARumvCA/uXZ cWw+Yi4KB18Z9MymgPxyJ32pL7dM2hRJ7jV5+OBZGN44gLpexc6puk7OOi2vXtlE RFTLHx4zGVczeLAfXPEKOm00SEV11y7FigB9DRAJrwhXs1GGrZT22D5bbH+uvjEb 8Bdm93FQhb7MxQGer70PVgldL67HrXTmurRK0to/Fo7bt5nlpd0udx1uQKAdmHZ0 WH6D6xfSwtFgkMvYp6Jw5dH8hjKSfrkbWhu0tb9qk8Y5STVBpHi57t3K3oj4rx+M UFb99lB9mSVIxM7iXcRv =8yYS -----END PGP SIGNATURE----- --yQ6PUHtvLgXN2OhJ--