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=SBkClfWlDusaIl9/wc7iDJ8nsDP8nPi970VFl1xIlWe61v7neDPzg
	Kd7zhvL5jPgO200Nieyo2HbxGfnbCYtHND9grlxqGYtAySx36qhMg63DLbb6gseT
	9CfiGWcLkiXa1udqBuji/od0CxjR/vhkxn0LU2VWckUxkM5WG0LYrc=
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=A3WKVrr/0mkJW2bfegZ39BjqonI=; b=MBI5La9M8wYwk4rWZ/Yb8N1dcS8w
	4mts/9DFh23UJEiWM79mZKTBDkQRlcZp97YAMwGMbZnqNtrL9mFMKTVGI3Pqf4Py
	yyKbKNb9OL8ULkn0Jef0X41yX+qaglHWGAxJhSOIV3SsmkA4mQI7evmuwwF3wmkm
	0z3tB7XBz6m8whI=
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=-0.6 required=5.0 tests=AWL,BAYES_50,BODY_8BITS,GARBLED_BODY autolearn=no version=3.3.2
X-HELO: calimero.vinschen.de
Date: Fri, 18 Apr 2014 17:09:19 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: x86_64 Cygwin 1.7.29: possible bug to trace symlink (Win7)
Message-ID: <20140418150919.GD16638@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <0BA358A6A1AD484EA0BECE9A36AA31753D6F7D00@rsex2.realsil.com.cn> <0BA358A6A1AD484EA0BECE9A36AA31753D6FCBC2@rsex2.realsil.com.cn> <0BA358A6A1AD484EA0BECE9A36AA31753D6FCC48@rsex2.realsil.com.cn> <20140416154756.GW3271@calimero.vinschen.de>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;	protocol="application/pgp-signature"; boundary="s/l3CgOIzMHHjg/5"
Content-Disposition: inline
In-Reply-To: <20140416154756.GW3271@calimero.vinschen.de>
User-Agent: Mutt/1.5.21 (2010-09-15)

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

On Apr 16 17:47, Corinna Vinschen wrote:
> On Apr 16 03:39, =E5=8D=9C=E5=8B=87=E5=8D=8E wrote:
> > Hi Corinna,
>=20
>=20
> Please don't top-post.  Thank you.
>=20
>=20
> > Below is what I get:
> > RS-I9E3U8R4:[~/tmp/test_symlink]>uname -a
> > CYGWIN_NT-6.1 RS-I9E3U8R4 1.7.29(0.272/5/3) 2014-04-07 13:46 x86_64 Cyg=
win
> > RS-I9E3U8R4:[~/tmp/test_symlink]>echo $CYGWIN
> > winsymlinks:nativestrict
> > RS-I9E3U8R4:[~/tmp/test_symlink]>echo test > test.txt
> > RS-I9E3U8R4:[~/tmp/test_symlink]>mkdir dest
> > RS-I9E3U8R4:[~/tmp/test_symlink]>cd dest
> > RS-I9E3U8R4:[~/tmp/test_symlink/dest]>ln -s ../test.txt test.txt
> > RS-I9E3U8R4:[~/tmp/test_symlink/dest]>cd ../
> > RS-I9E3U8R4:[~/tmp/test_symlink]>mkdir src
> > RS-I9E3U8R4:[~/tmp/test_symlink]>cd src
> > RS-I9E3U8R4:[~/tmp/test_symlink/src]>ln -s ../dest dest
> > RS-I9E3U8R4:[~/tmp/test_symlink/src]>cd ../
> > RS-I9E3U8R4:[~/tmp/test_symlink]>cat src/dest/test.txt
> > cat: src/dest/test.txt: No such file or directory
>=20
> I can reproduce it now.  I made a mistake when creating the symlinks
> the first time, which is, I created them with tcsh.  Tcsh tends to
> change relative paths using ".." components to absolute paths on the
> command line.  Using plain relative paths, I now see what's going on.
>=20
> But it'sa tricky problem.  I don't know how to fix it yet.  I'll
> have to think about it, so please be patient.

This is a very interesting problem which (again) shows the downsides of
the Cygwin path handling, namely the evaluation of the path from right
to left, contrary to what POSIX demands.  We really have to rewrite this
code, but that's a lot of work for long and dark winter nights and days,
not something we can do out of the blue.

Therefore, I created a workaround within the constraints of the current
code.  Please try the today's snapshot from http://cygwin.com/snapshots/,
it contains my workaround.

Note that in the current configuration we're having a recursion problem.
If your path consists of more than 15 native symlinks, all of which have
a ".." path component in the symlink target path, the result will be a
"no such file or directory" again.  This is pretty unlikely in normal
life, but can be easily constructed, of course.


Thanks,
Corinna

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

--s/l3CgOIzMHHjg/5
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJTUUAfAAoJEPU2Bp2uRE+ghGgP/AqMXNZL0Y4V/MphHpgc9pmx
XlcYRXD8bI/EOd8S/TQ4f3XT4VmxflCOv0CnuSMUZyz67ajRJ42BAdxYCP9L2wGO
ELMXIAZ7lM4gl/mU5WemjJsFAeEyIQDY1p3MGEcs7qcbHSrHrMtXU+840pfzu+8t
E0KyDUcAKSlJbtn4L3BDJFn+y464AskbbAmx++YRP1+j5xbxQWLLd6iB/3UwllDF
FJXdEz0SPCXw25ZTe/1qvTXHNGKP+rrCaYSGwJ42Y9EfwokspgVtNw6mdZcbbT2/
ySp9QpvfQRvg533UhYCxPUB/toS+5L/rNt21kDk7dIhBnTBsHngZkm6R+F38nsws
MFKM8LP5WBIzoo1IYBZozrS59fBNiSf5UZ75X33teOYXg0DUNcfmJ2vlTVC8qc+n
B3kONsPw7H5IAcNT0/Mou0o4rLw32eg8dswpnPNX6XujRA7avZLtnUijlNM4bpH+
rAiDGcvz9F5OJ2uoXOJLJbd1U7x3QPlaQ2IH9jN/6pCAlOVtqqKauDsRCMuJVIid
gh6t3sZNr3eOnF43kK6RQPchkvlDhXhuMJHw6v6EOw6g4Hf4TOHLjb4rrdLUu7Gm
GANFYn8UtcYEXP4q/ieQMFu138Mprf0Yr650AoqZ+qCC9iX0ygrxWyfAsRw35wiM
SRmZdp/495mP4Dia5pDT
=I7j3
-----END PGP SIGNATURE-----

--s/l3CgOIzMHHjg/5--
