4

I don't know when this started happening, but, for some reason, none of my Subversion hooks are running anymore. I am running Subversion 1.6.9 on a Gentoo Linux machine, which has had its hooks work in the past. I am running Subversion through the svn_dav module for Apache2.2.

I modified the hook scripts that I make use of to write into a file in the /tmp directory owned by apache:apache whenever they are executed, but after making a commit, there is nothing in the file that should be written to. The scripts are executable and owned by apache:apache, so I don't think that is the issue.

Here is one of my test scripts (post-commit.sh) that isn't getting executed:

#!/bin/sh

/bin/echo post-commit >> /tmp/z_test
exit 0

After running a commit, I expect both the pre-commit.sh and post-commit.sh hooks to be run, but neither of them appear to be writing into the desired file (/tmp/z_test).

What's going on?

2

For some reason, Subversion no longer seems to accept arbitrary extensions on hook scripts. I did have the hooks named like 'post-commit.sh', but Subversion no longer seems to look for these. After renaming the hook script to 'post-commit', Subversion ran it right away.

I'm not sure what revision to Subversion changed this behavior, and it is not mentioned in the CHANGES file for 1.6.11.

1

Here's a couple of basic debug steps to check:

  1. Double check the user that your Apache process is running under to make sure it has permission to execute the hook script and write to the /tmp directory:

    ps -ef | grep httpd

  2. Make sure that you can execute the hook scripts from the command line while logged in as the apache user - most of the times I've had problems with SVN hooks, the scripts have either not had the right execute permissions or have contained typos that become obvious when executing from the command line.

If this doesn't help, here is a nice step by step guide to debugging hook scripts.

  • Your command shows that apache is running as the 'apache' user. Also, after executing the hook script using sudo, it works, but commiting to SVN does not cause any text to be put in the file. – Chris Lieb May 21 '10 at 20:21
  • I followed those instructions, but my hook still doesn't seem to execute when I commit. – Chris Lieb May 21 '10 at 20:41
0

Not sure if it will help, but I found this on StackOverflow.

https://stackoverflow.com/questions/1809323/svn-post-commit-hooks-have-stopped-working-after-upgrading-to-fogbugz-7

  • Thanks, but that doesn't match up with my problem. It appears that he was getting different values passed to his hook scripts than what he was expecting. Mine just aren't being executed at all. – Chris Lieb May 21 '10 at 18:12
0

copy from the tmpl and add exec to post-commit

   cp post-commit.tmpl post-commit
   chmod +x post-commit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.