Linux – Trac + SVN: Why post commit hook doesn’t work

linuxsvntrac

I want to use the standard Trac post-commit-hook for SVN.

I'm using Trac 0.11.4 and have downloaded this hook from their site. I've put it into /usr/local/bin/ and chmod +x'ed it.
The post-commit hook in /var/svn/myrepo/hooks/ looks just as Trac Guide advises:

#!/bin/sh
REPOS="$1"
REV="$2"
TRAC_ENV="/var/trac/mytracenv"
/usr/bin/python /usr/local/bin/trac-post-commit-hook -p "$TRAC_ENV" -r "$REV"

Trac environment directory /var/trac/mytracenv is writable for Subversion user. I'm running standalone svnserve, no Apache.

If I run
/usr/bin/python /usr/local/bin/trac-post-commit-hook -p /var/trac/mytracenv -r <somerev>
manually as Subversion user, it works as it should. However if I do a commit (using TortoiseSVN) it says:

Error post-commit hook failed (exit code 255) with no output.

What's the problem?

Best Answer

I assume the problem is permission-related. Make sure both the post-commit script and the rac-post-commit-hook have the proper privileges. If it works for you using the command line, try to do it as the user that is running the svn daemon (sudo -u svnuser [cmd]).

I could fix a similar problem a year or so ago by adding "chmod o+x" both of the scripts.

Related Topic