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

Re: who runs the hook scripts?

From: Erwan Lacoste <erwan.lacoste_at_rhapso.fr>
Date: 2004-08-09 15:32:02 CEST

> On Mon, 2004-08-09 at 07:29, Erwan Lacoste wrote:
>> Hi all,
>> I'm trying to tweak subversion, and I would like to know how the hook
>> scripts are run. I'm pretty sure that it's httpd when you access the
>> repository with Apache. But when a client uses the file:// protocol, it
>> looks like he is the one who runs the script. Am I right?
>
> No... they're run by libsvn_repos, which is a library that "wraps" the
> filesystem API in libsvn_fs. Specifically, they're called by
> svn_repos_fs_begin_txn_for_commit() and svn_repos_fs_commit_txn().
>
> In other words, any process which opens a repository and performs a
> commit has two choices:
>
> - it can be "low level": just use svn_fs.h (libsvn_fs), thereby
> circumventing hooks. This is what 'svnadmin load' does, for example.
>
> - it can be a normal good citizen, and be "high level": use
> svn_repos.h (libsvn_repos) to create and commit transcations. This is
> what svnserve, mod_dav_svn, and file:/// access all do.
>
>
>> However, is there any way I can change the user that runs the script?
>> eg, let's say I want a hook script to be run every time someone commits.
>> I
>> have a client using httpd to access repository, and the other one works
>> on
>> the server, so he access the repos with file://. Is there any way that
>> when the second user commits, the post-commit script is run by an httpd
>> user?
>
> Hm, nope... the hook script will always be executed by the process doing
> the commit. Perhaps the hook script can call a script which does a
> 'sudo -u other_user' before doing the real work?
>
> Or you can write a binary program, make it owned by a single user, set
> the +s bit, and have the hook script run that binary.
>
>
I tried the 'sudo ...' method, and the problem is that the second
developper is working on the server over ssh (strange habits), and
whenever I try a 'su' command with ssh, it returns a nice and sexy
"Segmentation fault"...
I'll try writting a program as you explained if I find the time. I'll keep
you informed of the result.
Thanx for your help

-- 
Erwan Lacoste
Stagiaire
RHAPSO
1, rue Galvani
91300 Massy
Tel +33 (0)1 60 13 79 50
Fax +33 (0)1 69 32 19 61
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Aug 9 15:40:05 2004

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.