This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: utility to update existing cygwin symlinks to native format? (was Re: native symlink)
- From: James Gregurich <bayoubengal at mac dot com>
- To: "cygwin-developers at cygwin dot com" <cygwin-developers at cygwin dot com>
- Date: Mon, 29 Apr 2013 18:19:14 -0700
- Subject: Re: utility to update existing cygwin symlinks to native format? (was Re: native symlink)
- References: <20130403152907 dot GD2468 at calimero dot vinschen dot de> <20130424103450 dot GM26397 at calimero dot vinschen dot de> <5177CABF dot 8040406 at openafs dot org> <20130424125043 dot GA18673 at calimero dot vinschen dot de> <51781CA4 dot 3040103 at openafs dot org> <20130424181412 dot GB26397 at calimero dot vinschen dot de> <3B3671F5-EBFE-480B-B592-90BA2270BDA6 at mac dot com> <42E7B9C6-1A6A-43D7-84B3-AEDD25EF4507 at mac dot com> <517F061D dot 5080201 at cygwin dot com> <671E245A-BDCD-4F46-90B7-9E73301126C1 at mac dot com> <20130430002548 dot GA7635 at ednor dot casa dot cgf dot cx> <9FCBD602-2D9C-4069-AA5F-682C32DE6D32 at mac dot com> <517F13D1 dot 8040105 at cwilson dot fastmail dot fm>
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.
-James