[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: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2004-08-09 14:46:03 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.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Aug 9 14:47:10 2004

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