X-Recipient: archive-cygwin@delorie.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=yHoX18G2D9Nt8GRUtKu7fv2/waK0SblJGZCGk7BBXknq3zx4xbLDe
	sVr2WYqYAgpQQMTiHAjGZ77WJykhpRKl/bQuqH5rwmhfXEHcrkpZznFUzzC2vZpI
	oXzcaCoqSMQ8acNT2VHYFNp6+MCrpqCcaK4x/SMlDP1agcMu97Eue8=
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=WVoaAh0jvLgw9I1mSybMX0rSByA=; b=qqryhh50o2ZLbL9ljLJpjwwr3OyK
	fbJsLsf4bPN8nS2m1MZ0qTTpXopgvVbyFCVU+It+PUcp0eZIL1feiZaTDJ9H5l49
	4zzK6EWZ7Uh7daGzkf2NNmcaHfYwKe6JXroyu4gNV7/TCm/xPUG4kg3uYidn/Kdl
	8P2Y5Fz1zNqFNAY=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-93.5 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_BRBL_LASTEXT,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=Hx-languages-length:1229, trash
X-HELO: calimero.vinschen.de
Date: Sun, 3 Jul 2016 13:14:36 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: symlinks to unlinked but open files should work
Message-ID: <20160703111436.GA6301@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <op.yjxvo5gyofd6j1@frascati.upc.de>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;	protocol="application/pgp-signature"; boundary="ReaqsoxgOBHFXBhH"
Content-Disposition: inline
In-Reply-To: <op.yjxvo5gyofd6j1@frascati.upc.de>
User-Agent: Mutt/1.6.1 (2016-04-27)

--ReaqsoxgOBHFXBhH
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jul  1 22:40, Helmut Karlowski wrote:
> Cygwin seems to look up a symlink wrong:
>=20
> When the target-file is unlinked while it is used by a process the file
> still exists and the symlink should point to that file.
>=20
> Test:
>=20
> ln -s out1 lout1
> exec >lout1
> rm out1
> [[ -w /dev/fd/1 ]] || echo /dev/fd/1 not writable 1>&2
> rm lout1
>=20
> Only on cygwin it prints the message.

You don't even need a symlink.  This will show the same result:

  exec >out1
  rm out1
  [[ -w /dev/fd/1 ]] || echo /dev/fd/1 not writable 1>&2

In Cygwin we move a deleted but still open file out of the way (into
the trash) so the path is incorrect afterwards but even if we wouldn't
do that, the underlying problem can't be solved:

The problem is that a deleted file in Windows can't be opened anymore.
If you translate the above -w <file> into a libc call access
("/dev/fd/1", W_OK) or its Windows equivalent, that call will always
fail on a deleted file.  Same for open/CreateFile, etc.

Sorry, but off the top of my head I don't see a feasible workaround for
this problem.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--ReaqsoxgOBHFXBhH
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXePOcAAoJEPU2Bp2uRE+gEX8P/jNtePX4QDqZ58fa4C5G0Ajk
LYq6c2U0UAHD89+IiqYCLN/N64C/UqhL5nzCz0E4c/kl65wIQ6N/sGBsZPy7S1nU
xuyaeupSga7lxmbD/gkLbxQmNiigponU3Gh1/lx6SjRWNH5FfK+qxzSViT5w57M9
xuGBTJRRspoLhyRwD4db9s/zpYgWLTSvOBKm7fUokPt9PJ4/CqRZtf5TGfOvrt7w
WI5/W98YqnXNMKsAsTLSGGQtHWOt1NtHmYaQrItQpIkAo+qa6LOIKD8ndVam2rmg
VQBdp0CCWbh6Y2ppZWpEXxqa0NLt+o2MJ08l1kfTc/AUNknQMQJeHklwD9NX7Wzi
kDVtY7ref+fSBdVwjglHsQ7UiRltAZvhIvlb6y7FdlFySALyGcSpt2akuwiCwoOx
O2Ttg7JT1dYjRFcy/snAmflSUsUiymXTRYv3qi00qbD4ykYCVXfEExqsT34r/Pc1
xtn2xBmmRxMwyNIloBV2bgzMYILWL+7mstdfDebmgxjXsr3EYzytUN130AiwNvRm
mwRsrN1pPUdRidbQ5oT2CpnMeWU2GL6QNwVwGOatqzY8Ug1Yctk8xGPTP/KFM/Wb
yrdS+petFL1uzqS8r5v3LHMvGmIEsWPbNNg1mFvPlYCylZuKtKKgwgdP+/u3EF6U
42Gs+mPVbGNi/T8q/hgL
=xckV
-----END PGP SIGNATURE-----

--ReaqsoxgOBHFXBhH--
