You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Randy Defauw <ra...@wandisco.com> on 2013/11/05 17:52:32 UTC

symlinks on Windows

Hi,

Any thoughts regarding supporting symlinks on Windows?  Windows has
supported symlinks since Vista:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365680(v=vs.85).aspx

Supporting cross-platform symlinks where possible will ease some
compatibility pain for cross-platform development.


Randy DeFauw I *Director, ALM Product Marketing*

WANdisco // *Non-Stop Data*

t. 720-255-2774
e. randy.defauw@wandisco.com
twitter @rdefauw <https://twitter.com/rdefauw>

-- 
Listed on the London Stock Exchange: WAND<http://www.bloomberg.com/quote/WAND:LN>

THIS MESSAGE AND ANY ATTACHMENTS ARE CONFIDENTIAL, PROPRIETARY, AND MAY BE 
PRIVILEGED.  If this message was misdirected, WANdisco, Inc. and its 
subsidiaries, ("WANdisco") does not waive any confidentiality or privilege. 
 If you are not the intended recipient, please notify us immediately and 
destroy the message without disclosing its contents to anyone.  Any 
distribution, use or copying of this e-mail or the information it contains 
by other than an intended recipient is unauthorized.  The views and 
opinions expressed in this e-mail message are the author's own and may not 
reflect the views and opinions of WANdisco, unless the author is authorized 
by WANdisco to express such views or opinions on its behalf.  All email 
sent to or from this address is subject to electronic storage and review by 
WANdisco.  Although WANdisco operates anti-virus programs, it does not 
accept responsibility for any damage whatsoever caused by viruses being 
passed.


Re: symlinks on Windows

Posted by Nico Kadel-Garcia <nk...@gmail.com>.
On Thu, Nov 7, 2013 at 4:24 AM, Thorsten Schöning <ts...@am-soft.de> wrote:
> Guten Tag Ben Reser,
> am Donnerstag, 7. November 2013 um 09:46 schrieben Sie:
>
>> I think nobody has put the effort into figuring out the appropriate way of
>> dealing with this.  The obvious thing to do would be to fall back to the
>> current behavior if the permission isn't available.
>
> Subversion could fall back to using junctions if the link target is a
> directory or hardlinks if it is a file. Junctions don't support links
> to things like network shares, though, but it's better than nothing
> and will surely cover 99% of the use cases. Hardlinks have the same
> caveat of course and suffer form recreation of files, like when a file
> gets reverted the former created hardlink to it will get invalid. But
> in theory as Subversion should normally be the on doing the revert it
> could beforehand get all hardlinks to the file and recreate those
> after the revert. Getting all hardlinks to a file is fast operation
> since Vista.

Please,lord, no. tracing the junctions back to where they originally
come from could be really, really awkward.

I'd not noticed the restriction for several reasons. I prefer to do my
development work on Linux, when I'm on Windows I have "administrator"
privileges so other software can work properly, and I avoid symlinks
as part of my source control like the plague since my unfortunate
encounter with the Perforce symlink bug. (One could change a symlink,
record the change, then check out the symlink in a new working copy
and it would be the old symlink: one had to delete, then re-add the
symlink to make it work properly.)

> Of course it sucks that symlinks are restricted on Windows, opposed to
> junctions and hardlinks, especially that Windows itself doesn't use
> symlinks that much at all, but relies heavily on hard links instead.
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning

Hardlinks inside a source control system are inherently dangerous.
Because the location of the othe rend of the junction is not apparent,
and because changes in one end of the junction would have to be
reflected in the logs of *both* ends of the link, it's begging for
real database pain to allow them.

Re: symlinks on Windows

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Branko Čibej,
am Donnerstag, 7. November 2013 um 11:23 schrieben Sie:

>      IMO it's a lot easier to just document the restriction on
> creating     symlinks on Windows. It's not that bad; it's a (group) 
> policy setting, which can be managed by IT admins for large    
> deployments. It's not as if every user would have to fiddle with the
> registry or anything. We can even have a nice error message with an 
> URL to the appropriate MS knowledge base article ...

+1

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail:Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


Re: symlinks on Windows

Posted by Branko Čibej <br...@wandisco.com>.
On 07.11.2013 10:24, Thorsten Schöning wrote:
> Guten Tag Ben Reser,
> am Donnerstag, 7. November 2013 um 09:46 schrieben Sie:
>
>> I think nobody has put the effort into figuring out the appropriate way of
>> dealing with this.  The obvious thing to do would be to fall back to the
>> current behavior if the permission isn't available.
> Subversion could fall back to using junctions if the link target is a
> directory or hardlinks if it is a file.

I think dealing with hardlinks would be a */major/* pain in the
unmentionable. They're not only hard to detect (perhaps a bit easier on
Windows than on Unix), they also share permissions (on Unix) and
read-only state (on WIndows) with the target; which is definitely
something that Subversion does not want.

I won't say a word about junctions ...

IMO it's a lot easier to just document the restriction on creating
symlinks on Windows. It's not /that/ bad; it's a (group) policy setting,
which can be managed by IT admins for large deployments. It's not as if
every user would have to fiddle with the registry or anything. We can
even have a nice error message with an URL to the appropriate MS
knowledge base article ...

-- Brane

-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com

Re: symlinks on Windows

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Ben Reser,
am Donnerstag, 7. November 2013 um 09:46 schrieben Sie:

> I think nobody has put the effort into figuring out the appropriate way of
> dealing with this.  The obvious thing to do would be to fall back to the
> current behavior if the permission isn't available.

Subversion could fall back to using junctions if the link target is a
directory or hardlinks if it is a file. Junctions don't support links
to things like network shares, though, but it's better than nothing
and will surely cover 99% of the use cases. Hardlinks have the same
caveat of course and suffer form recreation of files, like when a file
gets reverted the former created hardlink to it will get invalid. But
in theory as Subversion should normally be the on doing the revert it
could beforehand get all hardlinks to the file and recreate those
after the revert. Getting all hardlinks to a file is fast operation
since Vista.

Of course it sucks that symlinks are restricted on Windows, opposed to
junctions and hardlinks, especially that Windows itself doesn't use
symlinks that much at all, but relies heavily on hard links instead.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail:Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


Re: symlinks on Windows

Posted by Branko Čibej <br...@wandisco.com>.
On 07.11.2013 11:36, Philip Martin wrote:
> Ben Reser <be...@reser.org> writes:
>
>> On 11/5/13 8:52 AM, Randy Defauw wrote:
>>> Any thoughts regarding supporting symlinks on Windows?  Windows has supported
>>> symlinks since Vista:
>>>
>>> http://msdn.microsoft.com/en-us/library/windows/desktop/aa365680(v=vs.85).aspx
>>>
>>> Supporting cross-platform symlinks where possible will ease some compatibility
>>> pain for cross-platform development.
>> Probably the biggest issue here is that by default creating symbolic links
>> requires administrator access on Windows.
> Another issue is that CreateSymbolicLink also has a dwFlags parameter
> that needs to be set to zero for file targets and
> SYMBOLIC_LINK_FLAG_DIRECTORY for directory targets.  I don't know what
> happens if the flag has the "wrong" setting.  Does it only affect the
> delete operation?  Does Subversion have to update the flag as the target
> changes?  Does Subversion have to store the flag as well as the target
> path in the repository?

Oh duh ... forgot about that. This is yet another instance of brilliant
API design.

And then there's this:

http://stackoverflow.com/questions/229643/how-do-i-overcome-the-the-symbolic-link-cannot-be-followed-because-its-type-is


-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com

Re: symlinks on Windows

Posted by Philip Martin <ph...@wandisco.com>.
Ben Reser <be...@reser.org> writes:

> On 11/5/13 8:52 AM, Randy Defauw wrote:
>> Any thoughts regarding supporting symlinks on Windows?  Windows has supported
>> symlinks since Vista:
>> 
>> http://msdn.microsoft.com/en-us/library/windows/desktop/aa365680(v=vs.85).aspx
>> 
>> Supporting cross-platform symlinks where possible will ease some compatibility
>> pain for cross-platform development.
>
> Probably the biggest issue here is that by default creating symbolic links
> requires administrator access on Windows.

Another issue is that CreateSymbolicLink also has a dwFlags parameter
that needs to be set to zero for file targets and
SYMBOLIC_LINK_FLAG_DIRECTORY for directory targets.  I don't know what
happens if the flag has the "wrong" setting.  Does it only affect the
delete operation?  Does Subversion have to update the flag as the target
changes?  Does Subversion have to store the flag as well as the target
path in the repository?

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*

Re: symlinks on Windows

Posted by Ben Reser <be...@reser.org>.
On 11/5/13 8:52 AM, Randy Defauw wrote:
> Any thoughts regarding supporting symlinks on Windows?  Windows has supported
> symlinks since Vista:
> 
> http://msdn.microsoft.com/en-us/library/windows/desktop/aa365680(v=vs.85).aspx
> 
> Supporting cross-platform symlinks where possible will ease some compatibility
> pain for cross-platform development.

Probably the biggest issue here is that by default creating symbolic links
requires administrator access on Windows.  Users can be granted the permission
without being an administrator.  However, lacking the functionality for all
users (as is the case on unix) makes it possible to cause problems for users on
Windows without the permission.

http://superuser.com/questions/124679/how-do-i-create-a-link-in-windows-7-home-premium-as-a-regular-user

I think nobody has put the effort into figuring out the appropriate way of
dealing with this.  The obvious thing to do would be to fall back to the
current behavior if the permission isn't available.  My concern would be that
this would be confusing when the feature works for some users and doesn't for
other users based on something as obscure as Windows a user permission.