This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: [cygwin] Re: `CYGWIN=winsymlinks:nativestrict`, `ln -s target link` fails if target doesn't exist
- From: "Jason Pyeron" <jpyeron at pdinc dot us>
- To: <cygwin at cygwin dot com>
- Date: Fri, 29 Apr 2016 08:15:57 -0400
- Subject: RE: [cygwin] Re: `CYGWIN=winsymlinks:nativestrict`, `ln -s target link` fails if target doesn't exist
- Authentication-results: sourceware.org; auth=none
- References: <CAPTiy3NUXprQL6V0+Njc2L7XfhpqtC7oWFwNMhOEFZ2OZmddoQ at mail dot gmail dot com> <1606116423 dot 20160429020650 at yandex dot ru> <CAPTiy3OhkvWhGKCisnoLBFZqTL1_Rcq4-vdn0U8Qfnxk+WsX-A at mail dot gmail dot com> <5580e7fc-e227-d9d8-a186-b58c8b17cfa3 at lysator dot liu dot se>
> -----Original Message-----
> From: Peter Rosin
> Sent: Friday, April 29, 2016 8:03 AM
>
> On 2016-04-29 13:34, Gene Pavlovsky wrote:
> >>> POSIX says a symlink to a missing target is perfectly
> well-defined
> >>> (you can't stat() through it, but you can readlink() it). But
> >>> Windows native symlinks can't do that. So the problems you are
> >>> encountering all stem from the fact that you are trying
> to make Windows do something it can't.
> >>
> >> My initial reaction was that, too, but I tried mklink (CMD
> internal
> >> command)
> >>
> >>> mklink x y
> >>
> >> and it created the symlink in the empty directory just fine.
> >
> > This is my point exactly. Windows dangling symlinks can be
> created as
> > easily as in UNIX.
> > At least this is the case on my Win7 x64.
>
> No, it can't.
>
> c:\>mklink a b
> c:\>mkdir b
> c:\>cd b
> c:\b>cd ..
> c:\>cd a
> The directory name is invalid
> c:\>rmdir b
> c:\>echo hello > b
> c:\>type a
> hello
>
> It only works for dangling links to files. Not good enough.
To be more precise, you must choose file or dir symlinks at cretion time:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>cd C:\cygwin\tmp\winlinktest\dirs
C:\cygwin\tmp\winlinktest\dirs>mklink /D a b
symbolic link created for a <<===>> b
C:\cygwin\tmp\winlinktest\dirs>mkdir b
C:\cygwin\tmp\winlinktest\dirs>cd b
C:\cygwin\tmp\winlinktest\dirs\b>cd ..
C:\cygwin\tmp\winlinktest\dirs>cd a
C:\cygwin\tmp\winlinktest\dirs\a>cd ..
C:\cygwin\tmp\winlinktest\dirs>rmdir b
C:\cygwin\tmp\winlinktest\dirs>echo hello > b
C:\cygwin\tmp\winlinktest\dirs>type a
Access is denied.
C:\cygwin\tmp\winlinktest\dirs>del b
C:\cygwin\tmp\winlinktest\dirs>mkdir b
C:\cygwin\tmp\winlinktest\dirs>cd a
C:\cygwin\tmp\winlinktest\dirs\a>
Jason Pyeron
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -
- Jason Pyeron PD Inc. http://www.pdinc.us -
- Principal Consultant 10 West 24th Street #100 -
- +1 (443) 269-1555 x333 Baltimore, Maryland 21218 -
- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--
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