utility to update existing cygwin symlinks to native format? (was Re: native symlink)

James Gregurich bayoubengal@mac.com
Tue Apr 30 01:19:00 GMT 2013

On Apr 29, 2013, at 5:44 PM, Charles Wilson wrote:

> On 4/29/2013 8:34 PM, James Gregurich wrote:
>> On Apr 29, 2013, at 5:25 PM, Christopher Faylor  wrote:
>>> If you're asking "Did Corinna write a utility to do this?" the answer
>>> is extremely likely to be "No" since she would have mentioned it if
>>> she had.
>>> If you're asking "Will Corinna write a utility to do this?" I suspect
>>> that the answer is likely also "No".
>> Unfortunately, the utility is a necessity for practical use of the native symlink feature.  I'm not opposed to writing it if I can get the necessary public function exposed in path.cc.  I suppose the discussion can be tabled until she gets back. At a bare minimum, I'd need a function that returns the format of the symlink in question. With such a function, I could just delete the link and recreate it if the format is not native.
> The winln program is part of the most recent cygutils package (1.4.12). It was written by Daniel Colascione...

Reading the man-page you supplied, it doesn't sound like this utility is intended to replace an existing default symlink with a native one. 

The issue I see with this utility in terms of using it as a replacement for 'ln -s' is that it defaults to a file symlink type if the target does not exist. The desired behavior would be to fall back to the default implementation so that the directory tree is never invalid.  Also, if you are using software that has embedded calls to 'ln -s' or uses the symlinks() API call, this wouldn't help.

However, (with a little inspiration from Jeffery), I did think of a way to do it without further changing cygwin.  One could use the Win32 APIs to verify that a target file is a reparse point symlink. if it isn't, then one could delete it and recreate it through cygwin.  I will attempt that approach and report back in the near future.


More information about the Cygwin-developers mailing list