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

Re: Hooks behaviour with svnsync

From: Radomir Zoltowski <radomir.zoltowski_at_s3group.com>
Date: Wed, 02 Sep 2009 10:28:28 +0100

David Weintraub wrote:
> You also need a _*pre*_-commit or a _*start*_-commit hook that rejects
> any commits that are not done by the svnsync user on your mirror
> repository. The post-commit hook goes on the main repository to
> execute svnsync after each commit. (This is, in theory, optional. You
> could have a crontab run svnsync from another system entirely.)
>
> Basically, on the mirror site:
>
> * A "start-commit" hook that prevents anyone except the svnsync
> user from making commits.
> * A "pre-revprop-change" hook that prevents anyone except the
> svnsync user from making changes in the revision properties.
>
> And on your main repository (optional):
>
> * A "post-commit" hook that runs svnsync to syncronize the last
> commit to the mirror.
>
>
> On Tue, Sep 1, 2009 at 12:55 PM, Radomir Zoltowski
> <radomir.zoltowski_at_s3group.com <mailto:radomir.zoltowski_at_s3group.com>>
> wrote:
>
> Hi all,
>
> I am having a little problem to make svnsync work through
> post-commit +
> pre-revprop-change pair. My setup is logically identical to this one:
> http://blogs.open.collab.net/svn/2007/08/mirroring-repos.html
>
> However, if I perform a commit as a user other than 'svnsync', the
> post-commit works to the point that is executes pre-revprop-change on
> the mirror. Then the pre-revprop-change on mirror fails as it sees
> $USER
> as my username instead of 'svnsync'. It fails with:
>
> Warning: post-commit hook failed (exit code 1) with output:
> svnsync: Revprop change blocked by pre-revprop-change hook (exit
> code 1)
> with output:
> Only the svnsync user may change revision properties as this is a
> read-only, mirror repository.
>
> AFAIK, pre-revprop-change should restart on the mirror as 'svnsync',
> with clean env, because I literally tell it to do so in post-commit on
> master:
>
> SYNCUSER="svnsync"
> URL_TO_MIRROR_REPO="svn+ssh://svn.****/svnroot/****"
> SVNSYNC="****/bin/svnsync"
>
> $SVNSYNC synchronize --source-username $SYNCUSER --sync-username
> $SYNCUSER $URL_TO_MIRROR_REPO &
>
> Any ideas, why my local $USER propagates as far as to
> pre-revprop-change
> hook (or exactly $3 variable) on mirror? Initialisation in the hook is
> standard: USER="$3". Interestingly, both 'svnserve -t' processes on
> master and mirror are correctly owned by 'svnsync'.
>
> Ah, my Subversion is 1.6.4.
>
> Regards,
> Radomir Zoltowski
>
> The information contained in this e-mail and in any attachments is
> confidential and is designated solely for the attention of the
> intended recipient(s). If you are not an intended recipient, you
> must not use, disclose, copy, distribute or retain this e-mail or
> any part thereof. If you have received this e-mail in error,
> please notify the sender by return e-mail and delete all copies of
> this e-mail from your computer system(s).
> Please direct any additional queries to:
> communications_at_s3group.com <mailto:communications_at_s3group.com>.
> Thank You.
> Silicon and Software Systems Limited. Registered in Ireland no.
> 378073.
> Registered Office: South County Business Park, Leopardstown, Dublin 18
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2389808
> <http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2389808>
>
> To unsubscribe from this discussion, e-mail:
> [users-unsubscribe_at_subversion.tigris.org
> <mailto:users-unsubscribe_at_subversion.tigris.org>].
>
>
>
>
> --
> David Weintraub
> qazwart_at_gmail.com <mailto:qazwart_at_gmail.com>
Thanks for reading my long email.

I have start-commit working OK on mirror, it's exactly the same as in
the mentioned example, nothing fancy. In other words, my setup is nearly
identical.

On master I can commit, on mirror, I presume I couldn't, but I haven't
even tried. Once commiting on master, post-commit kicks off and executes
svnsync with --source-username svnsync --sync-username svnsync
credentials. It's over authorized SSH, so passwords are not necessary.

I presumed, that these credentials are effective on mirror and when the
sync happens, respective pre-revprop-change kicks off and allows svnsync
user in. Unfortunately, the hook exits 1, because it thinks that the
username is me! I did originally commit to the master, but the
post-commit sync transaction should not use my credentials any more, but
the svnsync user as specified literally. It does not even come close to
start-commit hook, because sync cannot obtain repo lock obviously.

This is the problem. I still can't figure out how the synchronisation
uses my username ($3 == 'rz' on mirror!), when I told it to use svnsync
user.

In effect all commits work, but the sync does not. Only svnsync user can
commit and successfully post-commit synchronise, obviously. It must be
something simple... Any ideas where to look?

Regards,
Radomir

The information contained in this e-mail and in any attachments is confidential and is designated solely for the attention of the intended recipient(s). If you are not an intended recipient, you must not use, disclose, copy, distribute or retain this e-mail or any part thereof. If you have received this e-mail in error, please notify the sender by return e-mail and delete all copies of this e-mail from your computer system(s).
Please direct any additional queries to: communications_at_s3group.com.
Thank You.
Silicon and Software Systems Limited. Registered in Ireland no. 378073.
Registered Office: South County Business Park, Leopardstown, Dublin 18

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-09-02 11:29: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.