public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: David Macek <david.macek.0@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Symlink targets dereferenced when winsymlinks:native
Date: Tue, 24 Nov 2015 21:48:00 -0000	[thread overview]
Message-ID: <5654BFC3.9090901@gmail.com> (raw)
In-Reply-To: <20151120092618.GA20182@calimero.vinschen.de>

[-- Attachment #1: Type: text/plain, Size: 2410 bytes --]

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 affects it, but no luck, still absolute paths.
>>
>> I'm on Windows 10, if it makes any difference.
> 
> 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.
> 
> 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)

It seems it's dependent on the directory after all. The shell doesn't seem to affect it, at least not in my tests.

My test command is `touch 1 && ln -s 1 2`, then I clean up by `rm 1 2`. Now the results:

in /bin/: relative
in /: absolute
in ~/ (/cygdrive/c/Users/username/): relative
in /cygdrive/w/: absolute

Note that W: is a permasubst (created using `DOSDevices` in registry), which 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.

Can you confirm?

Output of `mount`:

D:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
D:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
D:/cygwin64 on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
D: on /cygdrive/d type ntfs (binary,posix=0,user,noumount,auto)
J: on /cygdrive/j type ntfs (binary,posix=0,user,noumount,auto)
W: on /cygdrive/w type ntfs (binary,posix=0,user,noumount,auto)

-- 
David Macek


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4254 bytes --]

  reply	other threads:[~2015-11-24 19:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 22:28 David Macek
2015-11-18 17:55 ` Corinna Vinschen
2015-11-18 18:13   ` David Macek
2015-11-18 19:48     ` Corinna Vinschen
2015-11-18 20:01       ` Warren Young
2015-11-18 20:07         ` Corinna Vinschen
2015-11-19 18:53       ` David Macek
2015-11-19 19:36         ` Nellis, Kenneth
2015-11-19 21:17           ` David Macek
2015-11-20  9:26             ` Corinna Vinschen
2015-11-24 21:48               ` David Macek [this message]
2015-11-26 12:02                 ` Corinna Vinschen
2015-11-29 14:10                   ` David Macek
2015-11-29 17:10                     ` Corinna Vinschen
2015-11-20  9:29         ` Corinna Vinschen
2015-11-24 19:51           ` David Macek
2015-11-25  3:20   ` Linda Walsh
2015-11-25 14:59     ` David Macek
2015-11-26 11:53       ` Another reason to not corrupt winnative symlinks: :currenly, they are linux-CIFS compat. Cygwin's are not Linda Walsh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5654BFC3.9090901@gmail.com \
    --to=david.macek.0@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).