You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <d....@daniel.shahaf.co.il> on 2008/04/27 14:07:42 UTC

[PATCH] svnsync init URL1 URL1

I discovered today by accident that trunk svnsync doesn't care if the 
source and destination are the same:

	> svnsync init file:///tmp/repos file:///tmp/repos
	Copied properties for revision 0 (svn:sync-* properties skipped).

This patch changes it to notice that:

	> svnsync init file:///tmp/repos file:///tmp/repos
	..\..\..\subversion\svnsync\main.c:632: (apr_err=195012)
	svnsync: Cannot sync a repository to another with the same UUID

The run_test() function in svnsync_tests took advantage of this by setting the
mirror's UUID to the source's UUID as soon as it created the mirror.  This
patch makes it not do so until it finished running svnsync.

This only touches the 'initialize' command, so it doesn't prevent people
from setting their mirrors' UUID to the mirrored repos's UUID after they
initialize the mirror.

Passes svnsync_tests.py.

[[[
In svnsync, do not allow source and destination to be the same repository.

* subversion/svnsync/main.c
  (do_initialize):
    Return an error when FROM_UUID equals TO_UUID.

* subversion/tests/cmdline/svnsync_tests.py
  (uuid):  Import.
  (run_test):  Defer setting the mirror repository's UUID to the source
    repository's UUID to just before comparing the dumpfiles.
]]]

Re: [PATCH] svnsync init URL1 URL1

Posted by Daniel Shahaf <d....@daniel.shahaf.co.il>.
Mark Phippard wrote on Sun, 27 Apr 2008 at 11:14 -0400:
> On Sun, Apr 27, 2008 at 11:09 AM, Arfrever Frehtes Taifersar Arahesis
> <ar...@gmail.com> wrote:
> > 2008-04-27 16:07:42 Daniel Shahaf napisał(a):
> >  > I discovered today by accident that trunk svnsync doesn't care if the
> >  > source and destination are the same:
> >  >
> >  >       > svnsync init file:///tmp/repos file:///tmp/repos
> >  >       Copied properties for revision 0 (svn:sync-* properties skipped).
> >  >
> >  > This patch changes it to notice that:
> >  >
> >  >       > svnsync init file:///tmp/repos file:///tmp/repos
> >  >       ..\..\..\subversion\svnsync\main.c:632: (apr_err=195012)
> >  >       svnsync: Cannot sync a repository to another with the same UUID
> >
> >  svn:sync-from-url, svn:sync-from-uuid and svn:sync-from-url can be set manually.

True, but what are you trying to say by stating this fact?

> >  I think that all svnsync subcommands should always check URLs rather UUIDs.
> 
> Isn't one of the main use-cases for svnsync to sync it to a repository
> that has the same UUID?  So that it can be used with the DAV
> mirroring, or as a hot-backup etc?
> 

As I said originally: the patch only touches do_initialize(), so it will
not distrub these use-cases.  After 'svnsync init', the destination
repos's UUID can be changed arbitrarily, svnsync won't even read it.

Before:

	rsync $REPOS $MIRROR
	svnsync init $MIRROR $REPOS
	#
	while true; do svnsync sync; done;

After:

	rsync $REPOS $MIRROR
	UUID=`svnlook uuid $MIRROR`
	svnadmin setuuid $MIRROR
	svnsync init $MIRROR $REPOS
	svnadmin setuuid $MIRROR $UUID
	#
	while true; do svnsync sync; done;

Daniel

Re: [PATCH] svnsync init URL1 URL1

Posted by Mark Phippard <ma...@gmail.com>.
On Sun, Apr 27, 2008 at 11:09 AM, Arfrever Frehtes Taifersar Arahesis
<ar...@gmail.com> wrote:
> 2008-04-27 16:07:42 Daniel Shahaf napisał(a):
>  > I discovered today by accident that trunk svnsync doesn't care if the
>  > source and destination are the same:
>  >
>  >       > svnsync init file:///tmp/repos file:///tmp/repos
>  >       Copied properties for revision 0 (svn:sync-* properties skipped).
>  >
>  > This patch changes it to notice that:
>  >
>  >       > svnsync init file:///tmp/repos file:///tmp/repos
>  >       ..\..\..\subversion\svnsync\main.c:632: (apr_err=195012)
>  >       svnsync: Cannot sync a repository to another with the same UUID
>
>  svn:sync-from-url, svn:sync-from-uuid and svn:sync-from-url can be set manually.
>  I think that all svnsync subcommands should always check URLs rather UUIDs.

Isn't one of the main use-cases for svnsync to sync it to a repository
that has the same UUID?  So that it can be used with the DAV
mirroring, or as a hot-backup etc?

-- 
Thanks

Mark Phippard
http://markphip.blogspot.com/

Re: [PATCH] svnsync init URL1 URL1

Posted by Arfrever Frehtes Taifersar Arahesis <ar...@gmail.com>.
2008-04-27 16:07:42 Daniel Shahaf napisał(a):
> I discovered today by accident that trunk svnsync doesn't care if the 
> source and destination are the same:
> 
> 	> svnsync init file:///tmp/repos file:///tmp/repos
> 	Copied properties for revision 0 (svn:sync-* properties skipped).
> 
> This patch changes it to notice that:
> 
> 	> svnsync init file:///tmp/repos file:///tmp/repos
> 	..\..\..\subversion\svnsync\main.c:632: (apr_err=195012)
> 	svnsync: Cannot sync a repository to another with the same UUID

svn:sync-from-url, svn:sync-from-uuid and svn:sync-from-url can be set manually.
I think that all svnsync subcommands should always check URLs rather UUIDs.

> The run_test() function in svnsync_tests took advantage of this by setting the
> mirror's UUID to the source's UUID as soon as it created the mirror.  This
> patch makes it not do so until it finished running svnsync.
> 
> This only touches the 'initialize' command, so it doesn't prevent people
> from setting their mirrors' UUID to the mirrored repos's UUID after they
> initialize the mirror.
> 
> Passes svnsync_tests.py.
> 
> [[[
> In svnsync, do not allow source and destination to be the same repository.
> 
> * subversion/svnsync/main.c
>   (do_initialize):
>     Return an error when FROM_UUID equals TO_UUID.
> 
> * subversion/tests/cmdline/svnsync_tests.py
>   (uuid):  Import.
>   (run_test):  Defer setting the mirror repository's UUID to the source
>     repository's UUID to just before comparing the dumpfiles.
> ]]]

-- 
Arfrever Frehtes Taifersar Arahesis

Re: [PATCH] svnsync init URL1 URL1

Posted by Daniel Shahaf <d....@daniel.shahaf.co.il>.
Ph. Marek wrote on Mon, 28 Apr 2008 at 10:26 +0200:
> On Montag, 28. April 2008, Daniel Shahaf wrote:
> > Ph. Marek wrote on Mon, 28 Apr 2008 at 09:51 +0200:
> > > On Montag, 28. April 2008, Daniel Shahaf wrote:
> > > > I am trying to prevent syncing an instance of a repository[1] to
> > > > itself. Is it possible to tell apart two instances that have the same
> > > > UUID?
> > > >
> > > > (Equality of UUIDs is a necessary but not sufficient condition for
> > > > identity of instances, and equality of URLs is sufficient but not
> > > > necessary.)
> > > >
> > > > [1] "An instance of", since in DAV mirroring, etc., there are actually
> > > > two "instances" of the same repository.
> > >
> > > Sounds to me like you need some second identity for each repository - not
> > > the subversion-client-UUID, but another real-repository-UUID :-)
> >
> > Exactly.
> >
> > > How about a revprop on r0? Seems to be the easiest, and most compatible,
> > > place for that.
> > >
> > > Set it if it doesn't exist; then query the other repository; if it's the
> > > same there, it's the same repository.
> >
> > And if the revprop exists when the master repository is duplicated?
> > (e.g. if there are two mirror sites.)  One could make 'svnadmin dump'
> > and 'svnsync' ignore the new property, but some people might tar or
> > rsync their master when they create the mirror.
> You're right, that's a problem.
> 
> Hmmm ... it seems that this is similar to the problem "on which harddisk 
> sector is that block" (that bootloaders need solved), when they go through 
> some intermediate layers - device mapper, raid, etc.
> 
> So there should possibly be some function that returns something like
>   MD5(hostname . "\0" . absolute path to the repository)
> which gets passed down to the *real* repository filesystem layers, and 
> answered *only* from them ...
> 
> Then you could still have a problem if the repository is on a NAS, and gets 
> mounted by two machines - one for http, one for svn+ssh ...
> 
> 
> Thinking along this lines I get a recursion - you need some value *for the 
> repository*, that doesn't get transferred *with* the repository ...
> 

Yes, that's the problem. :)

> So maybe some lookup table repos-UUID to real-ID, stored in some completely 
> different location - like /var/spool? But if you change the machine, you'd 
> like to keep it the same again ....
> 

Maybe store the real-id in the repository's parent directory?  (In 
/foo/r.id for repos in /foo/r/.)  That way it's easy to transfer it with 
the repository, but not unintentionally; and different machines mounting 
the same repos-instance would share the value.

(Has this been suggested before?  It sounds a bit familiar)

> 
> Don't know what's best - I think you've got a problem :-)
> - On one side you'll have to transfer that *with* the repository, but
> - on the other side you don't want to transfer it.
> 

If the value doesn't transfer with the repository, then (1) mounting
from ≥2 machines needs to be addressed; (2) If we also save the master's
id in the mirror (like we save master's UUID), then when the svnsync
master repository is moved to a different server all repositories that
mirror it must be manually told to expect the master's new instance-id.

> So, as conclusion - maybe take the revprop, and give an easy command "svnsync 
> new-repos-ID" or something like that, that can be run after the initial 
> rsync.
> 

If the value transfers with the repository, then when a repository is
duplicated the second copy needs to have its value changed.  (Only one
place needs manual tweaking, as opposed to all mirrors requiring
tweaking in the previous option.)  I guess this option is better.

> 
> 
> Regards,
> 
> Phil
> 

Re: [PATCH] svnsync init URL1 URL1

Posted by "Ph. Marek" <ph...@bmlv.gv.at>.
On Montag, 28. April 2008, Daniel Shahaf wrote:
> Ph. Marek wrote on Mon, 28 Apr 2008 at 09:51 +0200:
> > On Montag, 28. April 2008, Daniel Shahaf wrote:
> > > I am trying to prevent syncing an instance of a repository[1] to
> > > itself. Is it possible to tell apart two instances that have the same
> > > UUID?
> > >
> > > (Equality of UUIDs is a necessary but not sufficient condition for
> > > identity of instances, and equality of URLs is sufficient but not
> > > necessary.)
> > >
> > > [1] "An instance of", since in DAV mirroring, etc., there are actually
> > > two "instances" of the same repository.
> >
> > Sounds to me like you need some second identity for each repository - not
> > the subversion-client-UUID, but another real-repository-UUID :-)
>
> Exactly.
>
> > How about a revprop on r0? Seems to be the easiest, and most compatible,
> > place for that.
> >
> > Set it if it doesn't exist; then query the other repository; if it's the
> > same there, it's the same repository.
>
> And if the revprop exists when the master repository is duplicated?
> (e.g. if there are two mirror sites.)  One could make 'svnadmin dump'
> and 'svnsync' ignore the new property, but some people might tar or
> rsync their master when they create the mirror.
You're right, that's a problem.

Hmmm ... it seems that this is similar to the problem "on which harddisk 
sector is that block" (that bootloaders need solved), when they go through 
some intermediate layers - device mapper, raid, etc.

So there should possibly be some function that returns something like
  MD5(hostname . "\0" . absolute path to the repository)
which gets passed down to the *real* repository filesystem layers, and 
answered *only* from them ...

Then you could still have a problem if the repository is on a NAS, and gets 
mounted by two machines - one for http, one for svn+ssh ...


Thinking along this lines I get a recursion - you need some value *for the 
repository*, that doesn't get transferred *with* the repository ...

So maybe some lookup table repos-UUID to real-ID, stored in some completely 
different location - like /var/spool? But if you change the machine, you'd 
like to keep it the same again ....


Don't know what's best - I think you've got a problem :-)
- On one side you'll have to transfer that *with* the repository, but
- on the other side you don't want to transfer it.

So, as conclusion - maybe take the revprop, and give an easy command "svnsync 
new-repos-ID" or something like that, that can be run after the initial 
rsync.



Regards,

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by Daniel Shahaf <d....@daniel.shahaf.co.il>.
Ph. Marek wrote on Mon, 28 Apr 2008 at 09:51 +0200:
> On Montag, 28. April 2008, Daniel Shahaf wrote:
> > I am trying to prevent syncing an instance of a repository[1] to itself.
> > Is it possible to tell apart two instances that have the same UUID?
> >
> > (Equality of UUIDs is a necessary but not sufficient condition for
> > identity of instances, and equality of URLs is sufficient but not
> > necessary.)
> >
> > [1] "An instance of", since in DAV mirroring, etc., there are actually
> > two "instances" of the same repository.
> Sounds to me like you need some second identity for each repository - not the 
> subversion-client-UUID, but another real-repository-UUID :-)
> 

Exactly.

> How about a revprop on r0? Seems to be the easiest, and most compatible, place 
> for that.
> 
> Set it if it doesn't exist; then query the other repository; if it's the same 
> there, it's the same repository.
> 

And if the revprop exists when the master repository is duplicated?
(e.g. if there are two mirror sites.)  One could make 'svnadmin dump'
and 'svnsync' ignore the new property, but some people might tar or
rsync their master when they create the mirror.

> 
> Regards,
> 
> Phil
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by "Ph. Marek" <ph...@bmlv.gv.at>.
On Montag, 28. April 2008, Daniel Shahaf wrote:
> I am trying to prevent syncing an instance of a repository[1] to itself.
> Is it possible to tell apart two instances that have the same UUID?
>
> (Equality of UUIDs is a necessary but not sufficient condition for
> identity of instances, and equality of URLs is sufficient but not
> necessary.)
...
> [1] "An instance of", since in DAV mirroring, etc., there are actually
> two "instances" of the same repository.
Sounds to me like you need some second identity for each repository - not the 
subversion-client-UUID, but another real-repository-UUID :-)

How about a revprop on r0? Seems to be the easiest, and most compatible, place 
for that.

Set it if it doesn't exist; then query the other repository; if it's the same 
there, it's the same repository.


Regards,

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by Daniel Shahaf <d....@daniel.shahaf.co.il>.
David Glasser wrote on Mon, 28 Apr 2008 at 20:42 -0700:
> On Mon, Apr 28, 2008 at 8:30 PM, Branko Čibej <br...@xbc.nu> wrote:
> >
> > Daniel Shahaf wrote:
> >
> > > David Glasser wrote on Mon, 28 Apr 2008 at 11:56 -0700:
> > >
> > >
> > > > On Mon, Apr 28, 2008 at 10:36 AM, Daniel Shahaf
> > <d....@daniel.shahaf.co.il> wrote:
> > > >
> > > >
> > > > >  Possibly, but I don't think a check that prevents running
> > > > >  'svnsync init $R $R' (where $R is an empty repository) is
> > > > >  very useful.  Most likely $R can be thrown away and
> > > > >  recreated.
> > > > OK, in that case then I don't think any such check at all is useful :-)
> > > :)
> > >
> > > Thanks David.
> >
> >  Perhaps that was meant as a joke, but I'd take it quite seriously. I can't
> > think of any 100% certain way of detecting a "same instance", short of
> > actually inventing another hidden repository UUID just for svnsync. I also
> > don't think it's worth the trouble; presumably admins that do svnsync init
> > sort of know what they're doing. And if they don't, what real harm can it
> > do?
> 

Agreed.  Someday it might be nice to tell mirrors apart, but I can't see
any other use for it now.

> That is in fact what I meant.
> 
> Perhaps in the future I will make sure to include :-( after all of my
> serious statements.
> 
> --dave
> 
> 
> -- 
> David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/
> 

Re: [PATCH] svnsync init URL1 URL1

Posted by David Glasser <gl...@davidglasser.net>.
On Mon, Apr 28, 2008 at 8:30 PM, Branko Čibej <br...@xbc.nu> wrote:
>
> Daniel Shahaf wrote:
>
> > David Glasser wrote on Mon, 28 Apr 2008 at 11:56 -0700:
> >
> >
> > > On Mon, Apr 28, 2008 at 10:36 AM, Daniel Shahaf
> <d....@daniel.shahaf.co.il> wrote:
> > >
> > >
> > > >  Possibly, but I don't think a check that prevents running 'svnsync
> init
> > > >  $R $R' (where $R is an empty repository) is very useful.  Most likely
> $R
> > > >  can be thrown away and recreated.
> > > >
> > > >
> > > OK, in that case then I don't think any such check at all is useful :-)
> > >
> > >
> > >
> >
> > :)
> >
> > Thanks David.
> >
> >
>
>  Perhaps that was meant as a joke, but I'd take it quite seriously. I can't
> think of any 100% certain way of detecting a "same instance", short of
> actually inventing another hidden repository UUID just for svnsync. I also
> don't think it's worth the trouble; presumably admins that do svnsync init
> sort of know what they're doing. And if they don't, what real harm can it
> do?

That is in fact what I meant.

Perhaps in the future I will make sure to include :-( after all of my
serious statements.

--dave


-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

Re: [PATCH] svnsync init URL1 URL1

Posted by Branko Čibej <br...@xbc.nu>.
Daniel Shahaf wrote:
> David Glasser wrote on Mon, 28 Apr 2008 at 11:56 -0700:
>   
>> On Mon, Apr 28, 2008 at 10:36 AM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
>>     
>>>  Possibly, but I don't think a check that prevents running 'svnsync init
>>>  $R $R' (where $R is an empty repository) is very useful.  Most likely $R
>>>  can be thrown away and recreated.
>>>       
>> OK, in that case then I don't think any such check at all is useful :-)
>>
>>     
>
> :)
>
> Thanks David.
>   

Perhaps that was meant as a joke, but I'd take it quite seriously. I 
can't think of any 100% certain way of detecting a "same instance", 
short of actually inventing another hidden repository UUID just for 
svnsync. I also don't think it's worth the trouble; presumably admins 
that do svnsync init sort of know what they're doing. And if they don't, 
what real harm can it do?

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by Daniel Shahaf <d....@daniel.shahaf.co.il>.
David Glasser wrote on Mon, 28 Apr 2008 at 11:56 -0700:
> On Mon, Apr 28, 2008 at 10:36 AM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
> >  Possibly, but I don't think a check that prevents running 'svnsync init
> >  $R $R' (where $R is an empty repository) is very useful.  Most likely $R
> >  can be thrown away and recreated.
> 
> OK, in that case then I don't think any such check at all is useful :-)
> 

:)

Thanks David.

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by David Glasser <gl...@davidglasser.net>.
On Mon, Apr 28, 2008 at 10:36 AM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
> David Glasser wrote on Mon, 28 Apr 2008 at 07:02 -0700:
>
> > On Mon, Apr 28, 2008 at 12:24 AM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
>  > > David Glasser wrote on Sun, 27 Apr 2008 at 23:46 -0700:
>  > > > On Sun, Apr 27, 2008 at 10:38 PM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
>  > > > >  > Perhaps this check might be reasonable if it's actually a check that:
>  > >  > >  >
>  > >  > >  > * dest.HEAD == 0 (already done)
>  > >  > >  > * dest.uuid == src.uuid (your patch)
>  > >  > >  > and
>  > >  > >  > * src.HEAD == 0
>  > >  > >  >
>  > >  > >  > ie, "you're trying to sync from an empty repository to another empty
>  > >  > >  > repository with the same UUID; are you sure you entered two different
>  > >  > >  > repositories?"
>  > >  > >  >
>  > >  > >
>  > >  > >  Why src.HEAD == 0?  Suppose someone has many svnsync'ed same-UUID
>  > >  > >  repositories and creates a new repository.  When they create it, they
>  > >  > >  might create and init the mirror at the same time -- hitting this check.
>  > >  >
>  > >  > Well, I'm confused.  What are you actually trying to prevent with the
>  > >  > original check?
>  > >  >
>  > >
>  > >  I am trying to prevent syncing an instance of a repository[1] to itself.
>  > >  Is it possible to tell apart two instances that have the same UUID?
>  >
>  > I just think that in practice, the "dst.HEAD == 0" check will cover
>  > 99% of cases where somebody accidentally enters the same repository
>  > twice.
>  >
>
>  Possibly, but I don't think a check that prevents running 'svnsync init
>  $R $R' (where $R is an empty repository) is very useful.  Most likely $R
>  can be thrown away and recreated.

OK, in that case then I don't think any such check at all is useful :-)

--dave

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by Daniel Shahaf <d....@daniel.shahaf.co.il>.
David Glasser wrote on Mon, 28 Apr 2008 at 07:02 -0700:
> On Mon, Apr 28, 2008 at 12:24 AM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
> > David Glasser wrote on Sun, 27 Apr 2008 at 23:46 -0700:
> > > On Sun, Apr 27, 2008 at 10:38 PM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
> > > >  > Perhaps this check might be reasonable if it's actually a check that:
> >  > >  >
> >  > >  > * dest.HEAD == 0 (already done)
> >  > >  > * dest.uuid == src.uuid (your patch)
> >  > >  > and
> >  > >  > * src.HEAD == 0
> >  > >  >
> >  > >  > ie, "you're trying to sync from an empty repository to another empty
> >  > >  > repository with the same UUID; are you sure you entered two different
> >  > >  > repositories?"
> >  > >  >
> >  > >
> >  > >  Why src.HEAD == 0?  Suppose someone has many svnsync'ed same-UUID
> >  > >  repositories and creates a new repository.  When they create it, they
> >  > >  might create and init the mirror at the same time -- hitting this check.
> >  >
> >  > Well, I'm confused.  What are you actually trying to prevent with the
> >  > original check?
> >  >
> >
> >  I am trying to prevent syncing an instance of a repository[1] to itself.
> >  Is it possible to tell apart two instances that have the same UUID?
> 
> I just think that in practice, the "dst.HEAD == 0" check will cover
> 99% of cases where somebody accidentally enters the same repository
> twice.
> 

Possibly, but I don't think a check that prevents running 'svnsync init
$R $R' (where $R is an empty repository) is very useful.  Most likely $R
can be thrown away and recreated.

> --dave
> 
> >  (Equality of UUIDs is a necessary but not sufficient condition for
> >  identity of instances, and equality of URLs is sufficient but not
> >  necessary.)
> >
> >  Daniel
> >
> >  [1] "An instance of", since in DAV mirroring, etc., there are actually
> >  two "instances" of the same repository.
> >
> >
> 
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by David Glasser <gl...@davidglasser.net>.
On Mon, Apr 28, 2008 at 12:24 AM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
> David Glasser wrote on Sun, 27 Apr 2008 at 23:46 -0700:
>
> > On Sun, Apr 27, 2008 at 10:38 PM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
>
> > >  > Perhaps this check might be reasonable if it's actually a check that:
>  > >  >
>  > >  > * dest.HEAD == 0 (already done)
>  > >  > * dest.uuid == src.uuid (your patch)
>  > >  > and
>  > >  > * src.HEAD == 0
>  > >  >
>  > >  > ie, "you're trying to sync from an empty repository to another empty
>  > >  > repository with the same UUID; are you sure you entered two different
>  > >  > repositories?"
>  > >  >
>  > >
>  > >  Why src.HEAD == 0?  Suppose someone has many svnsync'ed same-UUID
>  > >  repositories and creates a new repository.  When they create it, they
>  > >  might create and init the mirror at the same time -- hitting this check.
>  >
>  > Well, I'm confused.  What are you actually trying to prevent with the
>  > original check?
>  >
>
>  I am trying to prevent syncing an instance of a repository[1] to itself.
>  Is it possible to tell apart two instances that have the same UUID?

I just think that in practice, the "dst.HEAD == 0" check will cover
99% of cases where somebody accidentally enters the same repository
twice.

--dave

>  (Equality of UUIDs is a necessary but not sufficient condition for
>  identity of instances, and equality of URLs is sufficient but not
>  necessary.)
>
>  Daniel
>
>  [1] "An instance of", since in DAV mirroring, etc., there are actually
>  two "instances" of the same repository.
>
>



-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by Daniel Shahaf <d....@daniel.shahaf.co.il>.
David Glasser wrote on Sun, 27 Apr 2008 at 23:46 -0700:
> On Sun, Apr 27, 2008 at 10:38 PM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
> >  > Perhaps this check might be reasonable if it's actually a check that:
> >  >
> >  > * dest.HEAD == 0 (already done)
> >  > * dest.uuid == src.uuid (your patch)
> >  > and
> >  > * src.HEAD == 0
> >  >
> >  > ie, "you're trying to sync from an empty repository to another empty
> >  > repository with the same UUID; are you sure you entered two different
> >  > repositories?"
> >  >
> >
> >  Why src.HEAD == 0?  Suppose someone has many svnsync'ed same-UUID
> >  repositories and creates a new repository.  When they create it, they
> >  might create and init the mirror at the same time -- hitting this check.
> 
> Well, I'm confused.  What are you actually trying to prevent with the
> original check?
> 

I am trying to prevent syncing an instance of a repository[1] to itself.
Is it possible to tell apart two instances that have the same UUID?

(Equality of UUIDs is a necessary but not sufficient condition for
identity of instances, and equality of URLs is sufficient but not
necessary.)

Daniel

[1] "An instance of", since in DAV mirroring, etc., there are actually
two "instances" of the same repository.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by David Glasser <gl...@davidglasser.net>.
On Sun, Apr 27, 2008 at 10:38 PM, Daniel Shahaf <d....@daniel.shahaf.co.il> wrote:
> David Glasser wrote on Sun, 27 Apr 2008 at 13:31 -0700:
>
> > 2008/4/27 Daniel Shahaf <d....@daniel.shahaf.co.il>:
>  > >  I discovered today by accident that trunk svnsync doesn't care if the
>  > >  source and destination are the same:
>  > >
>  > >         > svnsync init file:///tmp/repos file:///tmp/repos
>  > >         Copied properties for revision 0 (svn:sync-* properties skipped).
>  > >
>  > >  This patch changes it to notice that:
>  > >
>  > >         > svnsync init file:///tmp/repos file:///tmp/repos
>  > >         ..\..\..\subversion\svnsync\main.c:632: (apr_err=195012)
>  > >         svnsync: Cannot sync a repository to another with the same UUID
>  >
>  > I think the real use cases that this prevents are important, and this
>  > would just add another step of hassle.
>  >
>
>  OK.  (The hassle can be automated, but you know that.)  I hadn't
>  considered all possible uses -- I admit that.
>
>
>  > Perhaps this check might be reasonable if it's actually a check that:
>  >
>  > * dest.HEAD == 0 (already done)
>  > * dest.uuid == src.uuid (your patch)
>  > and
>  > * src.HEAD == 0
>  >
>  > ie, "you're trying to sync from an empty repository to another empty
>  > repository with the same UUID; are you sure you entered two different
>  > repositories?"
>  >
>
>  Why src.HEAD == 0?  Suppose someone has many svnsync'ed same-UUID
>  repositories and creates a new repository.  When they create it, they
>  might create and init the mirror at the same time -- hitting this check.

Well, I'm confused.  What are you actually trying to prevent with the
original check?

--dave

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by Daniel Shahaf <d....@daniel.shahaf.co.il>.
David Glasser wrote on Sun, 27 Apr 2008 at 13:31 -0700:
> 2008/4/27 Daniel Shahaf <d....@daniel.shahaf.co.il>:
> >  I discovered today by accident that trunk svnsync doesn't care if the
> >  source and destination are the same:
> >
> >         > svnsync init file:///tmp/repos file:///tmp/repos
> >         Copied properties for revision 0 (svn:sync-* properties skipped).
> >
> >  This patch changes it to notice that:
> >
> >         > svnsync init file:///tmp/repos file:///tmp/repos
> >         ..\..\..\subversion\svnsync\main.c:632: (apr_err=195012)
> >         svnsync: Cannot sync a repository to another with the same UUID
> 
> I think the real use cases that this prevents are important, and this
> would just add another step of hassle.
> 

OK.  (The hassle can be automated, but you know that.)  I hadn't
considered all possible uses -- I admit that.

> Perhaps this check might be reasonable if it's actually a check that:
> 
> * dest.HEAD == 0 (already done)
> * dest.uuid == src.uuid (your patch)
> and
> * src.HEAD == 0
> 
> ie, "you're trying to sync from an empty repository to another empty
> repository with the same UUID; are you sure you entered two different
> repositories?"
> 

Why src.HEAD == 0?  Suppose someone has many svnsync'ed same-UUID
repositories and creates a new repository.  When they create it, they
might create and init the mirror at the same time -- hitting this check.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnsync init URL1 URL1

Posted by David Glasser <gl...@davidglasser.net>.
2008/4/27 Daniel Shahaf <d....@daniel.shahaf.co.il>:
> I discovered today by accident that trunk svnsync doesn't care if the
>  source and destination are the same:
>
>         > svnsync init file:///tmp/repos file:///tmp/repos
>         Copied properties for revision 0 (svn:sync-* properties skipped).
>
>  This patch changes it to notice that:
>
>         > svnsync init file:///tmp/repos file:///tmp/repos
>         ..\..\..\subversion\svnsync\main.c:632: (apr_err=195012)
>         svnsync: Cannot sync a repository to another with the same UUID

I think the real use cases that this prevents are important, and this
would just add another step of hassle.

Perhaps this check might be reasonable if it's actually a check that:

* dest.HEAD == 0 (already done)
* dest.uuid == src.uuid (your patch)
and
* src.HEAD == 0

ie, "you're trying to sync from an empty repository to another empty
repository with the same UUID; are you sure you entered two different
repositories?"

--dave

>
>  The run_test() function in svnsync_tests took advantage of this by setting the
>  mirror's UUID to the source's UUID as soon as it created the mirror.  This
>  patch makes it not do so until it finished running svnsync.
>
>  This only touches the 'initialize' command, so it doesn't prevent people
>  from setting their mirrors' UUID to the mirrored repos's UUID after they
>  initialize the mirror.
>
>  Passes svnsync_tests.py.
>
>  [[[
>  In svnsync, do not allow source and destination to be the same repository.
>
>  * subversion/svnsync/main.c
>   (do_initialize):
>     Return an error when FROM_UUID equals TO_UUID.
>
>  * subversion/tests/cmdline/svnsync_tests.py
>   (uuid):  Import.
>   (run_test):  Defer setting the mirror repository's UUID to the source
>     repository's UUID to just before comparing the dumpfiles.
>  ]]]
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
>  For additional commands, e-mail: dev-help@subversion.tigris.org
>



-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org