delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/10/29/04:17:36

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 29 Oct 2009 10:17:16 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Symbolic links on NTFS with real symbolic links
Message-ID: <20091029091716.GM28753@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <003501ca5858$70595730$510c0590$@Mowbray AT calgacus DOT com> <4AE938D5 DOT 20500 AT cygwin DOT com>
MIME-Version: 1.0
In-Reply-To: <4AE938D5.20500@cygwin.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Oct 29 02:40, Larry Hall (Cygwin) wrote:
> On 10/29/2009 01:26 AM, Neil Mowbray wrote:
> >Dear Folks,
> >
> >On NTFS systems that support real symbolic links (eg those with Vista)
> >the comand ln -s does *not* create a native symbolic link merely an old
> >style shortcut.
> >
> >Will ln -s be chansed to support native symbolic links?
> 
> No, not until, at least, native symbolic links don't require
> elevated privileges to
> use.

And even then, no.  We need symlinks which support POSIX style content.
Native Windows symlinks are just reparse points with a special symlink
tag.  The path stored in them is expected to be a Win32 path.

Actually the target path is stored twice.  The "SubstituteName" is a
native NT path, the "PrintName" is just some UI string, in theory.  If
you use CMD's mklink command, the "PrintName" is filled with the Win32
path.

This looks like a neat way to use a symlink for POSIX paths.  Since
"SubstituteName" already contains the native NT path, just store the
POSIX path in "PrintName".  Unfortunately this doesn't work.  For some
reason the Win32 API requires the "PrintName" to contain the Win32 path,
otherwise you'll get "The system cannot find the file specified." error
messages.  And it also doesn't work the other way around.  If the
"PrintName" contains a valid Win32 path, and "SubstituteName" contains
the POSIX path, you *still* get the "The system cannot find..." error.

So there are two problems:

- Only users with administrator permissions can create native symlinks.

- Due to the way they are used in the Win32 API, there's no way to
  use them with POSIX paths *and* Win32 paths for interoperability.
  So why bother?

> >Also rm<link>  removes the target of the symbolic link not the link file.
> >Is this what you want?
> 
> Please provide a simple test case with the associated information requested
> by <http://cygwin.com/problems.html>.  I cannot reproduce this behavior.  Of
> course, I'm using Cygwin 1.7 <http://cygwin.com/#beta-test> on Windows 7.

Yes, indeed.  Cygwin 1.5 doesn't recognize native symlinks and
consequentially the unlink() function didn't use the
FILE_OPEN_REPARSE_POINT flag to open the file for deletion.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019