After the better part of two days of trying various permutation and combinations to get our SVN repository to update a local copy on the same server when a user commits I can get no further than running the script from the command line successfully. The script does not appear to execute when a user on another system runs a commit. There are hundreds of tutorials outlining a process to get this working and I've tried around five with no success. Here is the process I'm using at present ("usera" is the user who checked out the local copy of the repository which I want post-commit to update.
$ cd /path/to/repository/hooks
$ emacs post-commit.c
Contents of post-commit.c:
Code:
#define PATH_TO_POST_COMMIT_SCRIPT "/path/to/repository/hooks/post-commit.script
#include <sys/types.h>
#include <unistd.h>
main( ac, av ) char **av;
{
execv( PATH_TO_POST_COMMIT_SCRIPT, av );
}
Save file:
$ chown usera:usera
$ gcc -o post-commit post-commit.c
$ chmod 4755 post-commit
$ emacs post-commit.script
Contents of post-commit.c:
Code:
#! /bin/sh
/bin/echo 'Testing to see if script is executed' > debug.txt
Save file:
$ chown apache:apache post-commit.script
So, ownership and permissions of files so far...
-rwsr-xr-x 1 usera usera 6758 Feb 8 10:17 post-commit
-rw-r--r-- 1 root root 204 Feb 8 10:16 post-commit.c
-rwxr-xr-x 1 apache apache 2531 Feb 8 09:58 post-commit.script
Debugging
C wrapper runs successfully from command shell as user 'usera'
[usera]$ ./post-commit
[usera]$ cat debug.txt
Testing to see if script is executed
[usera]$ echo '' > debug.txt
But no post-commit process appears to run when a user on the network commits (i.e. debug.txt does not contain the test string). I've defined absolute paths to all files, executables referenced in both the C binary and the script but to no avail.
The checked out repository itself was done clean at the start of this process, all files owned by "usera". As far as I can tell (there are gaps in just about every tutorial I could find) I've set permissions/UIDs etc. correctly.
Can anyone point out where things might be going wrong?