Symlink targets dereferenced when winsymlinks:native

Linda Walsh cygwin@tlinx.org
Wed Nov 25 03:20:00 GMT 2015


Corinna Vinschen wrote:
>> If it matters, the use case is `ln -sf /proc/self/fd /dev/fd`.
> 
> It matters.  This is a bug in Cygwin, a missing test in fact.  It should
> never allow to create native symlinks to targets which only exist inside
> of Cygwin.
----
	Please don't.  Why?   It would be a built-in behavior
difference between unix/linux symlinks and cygwin.
symlink create on unix/linux doesn't look at the 'source'
and create different types of links or different behaviors
based on some ill-considered 'pathname filtering'.

>  Consider that /proc/self/fd has no meaning to non-Cygwin
> processes at all.
---
  Unless you have a file-system driver, or a ".desktop.ini" in a
windows created 'C:\Proc\.desktop.ini that redirects handlers
for \proc to something similar.  On my system, when I 
look at /proc/self/fd in cygwin+windows:
cyg:
/>  ll /proc/self/fd
total 0
lrwxrwxrwx 1 0 Nov 24 17:58 0 -> /dev/pty3
lrwxrwxrwx 1 0 Nov 24 17:58 1 -> /dev/pty3
lrwxrwxrwx 1 0 Nov 24 17:58 2 -> /dev/pty3
lrwxrwxrwx 1 0 Nov 24 17:58 3 -> /proc/21920/fd/
win:
/> cmd
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\>dir \proc\self\fd /w
dir \proc\self\fd /w
 Volume in drive C is System Disk
 Volume Serial Number is E889-68E4
 Directory of C:\proc\self\fd
[.]  [..] 
               0 File(s)              0 bytes
               2 Dir(s)  401,855,094,784 bytes free
----
i.e. it shows a directory that is empty, and
according to windows, was created over a year ago:
C:\>dir |grep -i proc
dir |grep -i proc
01/23/2014  05:13 PM    <DIR>          proc


As soon as you start prohibiting normal 'native' link
creation based on some assumption about "who owns the
path", I can't see how that won't end up biting you later.




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list