[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: how to make svn _follow_ symbolic links?

From: Blair Zajac <blair_at_orcaware.com>
Date: Tue, 21 Jul 2009 14:18:49 -0700

Misha Aizatulin wrote:
> Blair Zajac wrote:
>
>> It doesn't choke. It was deliberately designed to handle symbolic
>> links. If you re-symlink a symlink, then Subversion will see the change
>> and allow you to version path the symlink points to just as Subversion
>> version's file content changes.
>
> It is a nice feature, but it doesn't work, if the symlink points to a
> file outside of the repository. And this has to be the case, if I want
> to add the same file to two repositories.

I think you need to shift the way you're looking at it. It does work for what
it's been designed for and its this use case that is novel. We check in
symlinks all the time in our repositories and they work great. Nowhere in
Subversion has there ever been the desire to manage what the symlink points to.
  It seems to be a workaround for the lack of a repository that everyone has
rights to.

>>> Is there any reason not to implement following symbolic links? Is it a
>>> design decision or just due to the fact that no one requested it so far?
>>> Again, shall I write a feature request?
>> How would the feature work? How would you tell Subversion to follow
>> this link?
>
> I'd suggest setting a property, but I'd be happy with any method.

Yes, that would probably need to be the implementation. Something like a
svn:follow-symlink property.

>> How would Subversion work with updating that file atomically? What
>> happens if you have two svn updates running at the same time that want
>> to update the file at the location the symlink references?
>
> Well, what happens, if I try to manually change a regular file during
> an svn update? If the answer is "a mess", then there is no bigger mess
> with symlinks. If the answer is "svn uses locking / checksum
> verification / whatever", then why not apply these mechanisms to the
> target of the link?

Because it's outside the working copy.

Right now there's locking in a working copy to prevent concurrent modifications
to any files. We treat the files very specially and even wrote a journaling
system in the working copy to prevent data lose.

And how would you coordinate locks between two different working copies as you
want to do. Remember, there's no .svn directory where you want this file to live.

> With one word, svn should treat the link target exactly as if it were
> a regular file.
>> BTW, it takes more work in the code to follow them then not too, because
>> you have to check if it's a symlink or not and then use readlink() to
>> get what the symlink points to.
>
> Oh, ok. I always thought that doing a regular open() would follow the
> links, so that if the programmer does nothing, the links are treated
> transparently. I never checked myself though.

open() does follow the link. The Subversion source code checks if the file is
a symbolic link before deciding to open() or readlink() it when "reading" it and
open() or symlink() when updating it.

Regards,
Blair

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2373467

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-07-21 23:19:45 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.