From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 107078 invoked by alias); 26 Nov 2015 11:53:45 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 107066 invoked by uid 89); 26 Nov 2015 11:53:44 -0000 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 Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Nov 2015 11:53:43 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 05AE2A805ED; Thu, 26 Nov 2015 12:53:40 +0100 (CET) Date: Thu, 26 Nov 2015 12:02:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Symlink targets dereferenced when winsymlinks:native Message-ID: <20151126115339.GK2755@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <564E1AA0.6070001@gmail.com> <0D835E9B9CD07F40A48423F80D3B5A702E9519BE@USA7109MB022.na.xerox.net> <564E3C5B.10006@gmail.com> <20151120092618.GA20182@calimero.vinschen.de> <5654BFC3.9090901@gmail.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) X-SW-Source: 2015-11/txt/msg00423.txt.bz2 --K1n7F7fSdjvFAEnM Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2686 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 Content-length: 819 -----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--