public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Jason Pyeron" <jpyeron@pdinc.us>
To: <cygwin@cygwin.com>
Subject: RE: [cygwin] Re: `CYGWIN=winsymlinks:nativestrict`, `ln -s target link` fails if target doesn't exist
Date: Fri, 29 Apr 2016 12:20:00 -0000	[thread overview]
Message-ID: <C0C0565790DF4779873615FEE70B2765@black7> (raw)
In-Reply-To: <5580e7fc-e227-d9d8-a186-b58c8b17cfa3@lysator.liu.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

  reply	other threads:[~2016-04-29 12:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 22:18 Gene Pavlovsky
2016-04-28 23:48 ` Andrey Repin
2016-04-29  0:06   ` Eric Blake
2016-04-29  5:23     ` Andrey Repin
2016-04-29  0:09   ` Gene Pavlovsky
2016-04-29  1:46     ` Gene Pavlovsky
2016-04-29 12:03   ` Gene Pavlovsky
2016-04-29 12:15     ` Peter Rosin
2016-04-29 12:20       ` Jason Pyeron [this message]
2016-04-30 12:35       ` Gene Pavlovsky
2016-10-05  3:56         ` Rinrin
2016-10-05  4:31           ` Marco Atzeri
2016-10-06 10:38           ` Gene Pavlovsky
2016-10-07  5:33             ` Rinrin
2016-10-09 19:16               ` Gene Pavlovsky

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=C0C0565790DF4779873615FEE70B2765@black7 \
    --to=jpyeron@pdinc.us \
    --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).