Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been struggling for the past couple days to get post-commit email notifications working on my SVN server (running via HTTP with Apache2 on Ubuntu 9.10). SVN commits work fine, but for some reason the hooks are not being properly executed.

Here are the configuration settings: - Users access the repo via HTTP with the apache dav_svn module (I created users/passwords via htpasswd in a dav_svn.passwd file).

dav_svn.conf:

 <Location /svn/repos>
  DAV svn
  SVNPath /home/svn/repos

  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd

  Require valid-user
  </Location>
  • I created a post-commit hook file that writes a simple message to a file in the repository root:

/home/svn/repos/hooks/post-commit:

#!/bin/sh

REPOS="$1"
REV="$2"

/bin/echo 'worked' > ${REPOS}/postcommit.log

I set the entire repository to be owned by www-data (the apache user), and assigned 755 permissions to the post-commit script

when I test the post-commit script using the www-data user in an empty environment, it works:

sudo -u www-data env - /home/svn/repos/hooks/post-commit /home/svn/repos 7

But when I commit on a client machine, the commit is successful, but the post-commit script does not seem to be executed.

I also tried running a simple script for the pre-commit hook, and I get an error, even with an empty pre-commit script:

"Commit failed (details follow): Can't create null stdout for hook '/home/svn/repos/hooks/pre-commit': Permission denied"

I did a few searches on Google for this error and I presume that this is an issue with the apache user (www-data) not having adequate permissions, specifically to execute /dev/null. I also read that the reason post-commit fails silently is because that it doesn't report with stdout.

Anyway, I've also tried giving the apache user (www-data) ownership of the entire repository, and edited the apache virtualhost to allow operations on the server root, and I'm still getting permission denied

/etc/apache2/sites-available/primarydomain.conf

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
</Directory>

Any ideas/suggestions would be greatly appreciated! Thanks

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

So, after discussing this issue with a very helpful system administrator at the BEST hosting provider ever, RailsPlayground, they were able to fix the problem by setting the permissions on /dev/null to

crw-rw-rw- 1 root   root    1,   3

and now, all SVN hooks work as expected.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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