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=j9BsYXdr7rf9E3AIc6wk9lmRKOF1Lo3uGetkH0QZNSoaPB/wnsDPN ryR+KoxJY5cYgKLJr334fQ/AKb7pS9XDinbYWI3siQuae5fv0SJdQ1fUj4GJDGMY FnmAEi0jxlDprl9kZuzcUNdojvvTW3ZhiEEEDROhjIBIkN00fuJwzE= 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=FUHxKx0GF014HEcKfHcJo5XRRNY=; b=UB0XT5LAkOPrxLZy4mxZQ04/G6CA 7siYEm+UDnqDXW7LxrDqisqABuCvI8FSQFAFvUX4L3yZy8dXRVQIkjHndbHSeu2c ToBUD3F8xObHW9YXMt+b/PiIRIyWs9ZwZCd9i4c6ZwHPJ7kJpjI6+JTKafm6CAWX 5vbS1G310QPl0Lg= 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, 26 Nov 2015 12:53:39 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Symlink targets dereferenced when winsymlinks:native Message-ID: <20151126115339.GK2755@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <564E1AA0 DOT 6070001 AT gmail DOT com> <0D835E9B9CD07F40A48423F80D3B5A702E9519BE AT USA7109MB022 DOT na DOT xerox DOT net> <564E3C5B DOT 10006 AT gmail DOT com> <20151120092618 DOT GA20182 AT calimero DOT vinschen DOT de> <5654BFC3 DOT 9090901 AT gmail DOT com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="K1n7F7fSdjvFAEnM" Content-Disposition: inline In-Reply-To: <5654BFC3.9090901@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Note-from-DJ: This may be spam --K1n7F7fSdjvFAEnM Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Nov 24 20:51, David Macek wrote: > On 20. 11. 2015 10:26, Corinna Vinschen wrote: > > On Nov 19 22:17, David Macek wrote: > >> On 19. 11. 2015 20:36, Nellis, Kenneth wrote: > >>> FWIW, my results are different: > >>> > >>> $ printenv CYGWIN > >>> winsymlinks:nativestrict > >>> $ touch XXX > >>> $ ln -s XXX YYY > >>> $ ln -s YYY ZZZ > >>> $ ls -l > >>> total 0 > >>> -rw-r----- 1 knellis Domain Users 0 Nov 19 14:28 XXX > >>> lrwxrwxrwx 1 knellis Domain Users 3 Nov 19 14:28 YYY -> XXX > >>> lrwxrwxrwx 1 knellis Domain Users 3 Nov 19 14:28 ZZZ -> YYY > >>> $ uname -svr > >>> CYGWIN_NT-6.1 2.3.1(0.291/5/3) 2015-11-14 12:44 > >>> $ > >> > >> Weird. I also tried in the virtual root directory, in case cygdrive af= fects it, but no luck, still absolute paths. > >> > >> I'm on Windows 10, if it makes any difference. > >=20 > > No, I'm on W10 either and it works for me as for Kenneth. The path > > evaluation in the function creating native symlinks tries to create > > relative Windows paths if the incoming target path is relative, too. > > Basically it compares the path prefixes, eliminates as much of > > the path as possible and prepends "..\\" as required. > >=20 > > I don't see a reason why this shouldn't work for you, unless the > > shell mangles the paths before passing them to the ln command (yes, > > this really may happen with some shells depending on settings) >=20 > It seems it's dependent on the directory after all. The shell doesn't see= m to affect it, at least not in my tests. >=20 > My test command is `touch 1 && ln -s 1 2`, then I clean up by `rm 1 2`. N= ow the results: >=20 > in /bin/: relative > in /: absolute > in ~/ (/cygdrive/c/Users/username/): relative > in /cygdrive/w/: absolute >=20 > Note that W: is a permasubst (created using `DOSDevices` in registry), wh= ich would explain the different behaviour (but not excuse it :), but I don'= t see why / is also special. Even if only one from the link pair (target or= source) is in a relative-symlink-unsupporting path, I get an absolute path. >=20 > Can you confirm? Yes, thanks for this part of the analysis. There was a typo in the code checking the relative paths. The check for a drive colon in the pathname used a wrong offset into the path string, which ultimately always created an absolut path to the target if the path of the target was in a drive's root dir or one level below that. I fixed that in the repo and created a new developer snapshot for testing: https://cygwin.com/snapshots/ 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 --K1n7F7fSdjvFAEnM Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWVvLDAAoJEPU2Bp2uRE+gK7oQAIyDH/AYmSG3OV/sf8nKUQka gweQm8IGwd1ZpEnXRVp2pGtbPYgXiFA2eGhbUAW9erxR0+1Ni6h/9Fci1RVDs/W+ YVZFJfRZeWIkkohPWP3nlRSA5k2P4uAraHlTyH6k4tx9zL+3Ogz7Z/DQdlVWdW9v h9vafzwqnyqR+jsWiyAGzZb+ktG7mmvQgiiApOFW3UOtB02CMM0DWAJbEr2/1Ev6 zpo1V1+pQCmbjCOUwGRqIsCnKpuIJh8uImfNXP2/3IHZmb/DfEUqgyrGSJkeKtMP 6+0ReqOHqYQmaDlTQ7LNknToZfu5G6Fx+upjsL6qmtKi93Dv3gEI5j9jeaYWWZOD N+1BKHKWFdie/SGZU2jDp1kKsEIpn2o/HdJ8reEay+FZDoG28C4tkrwzFBEDoIjE pzugTwXSGsBSqD8+iexgScAkJTLft6sMiOqgBk+OwfvkTIGml8o0RwtKfraGLagO Iffe72kbybMOCmY1xAwMYUsdA5vvuoYnprf+5tuiUrQbHzXgL9wFU1xl2vCmn818 2gRIxRYTuDNGK7HsI1fZVcpWG0a/4b3oHZrI4SUeOXtBcdNeEQ2F3zzLvH3Rn/cz X7rg20oVWRhX7ECpnPf/mzqrPRoLxFDjRBwqcWPdGd5h2zBxsuUflG3kdoH1LWXa zWfYWY6enzVNfIwdzFyg =r2GR -----END PGP SIGNATURE----- --K1n7F7fSdjvFAEnM--