Linux – Why is the post-commit Apache Subversion hook failing

emaillinuxsvn

So I am trying to get a post-commit hook working on my Apache Subversion server, specifically I'm trying to send email to my Google account as described on this link.

After setting the permissions for the script and the working copy to the same user and read/write access it started causing MERGE errors when users tried to commit.

After some reading I found out that it was because of the post-commit hook not working and found out that by typing

svn - ./post-commit commit  ../ 250 mailer.conf

I get this error:

> annerajb@annerajb-desktop:~/Desktop/TotEM_SVN/hooks$ env - ./post-commit.test commit ../ 250

/var/lib/python-support/python2.6/svn/fs.py:27: DeprecationWarning: The popen2 module is deprecated.  Use the subprocess module.

  import sys as _sys, os as _os, popen2 as _popen2, tempfile as _tempfile

Traceback (most recent call last):

  File "/usr/share/subversion/hook-scripts/mailer/mailer.py", line 1351, in <module>
    svn.core.run_app(main, cmd, config_fname, repos_dir, sys.argv[3:3+expected_args])

  File "/var/lib/python-support/python2.6/svn/core.py", line 288, in run_app
    return apply(func, (application_pool,) + args, kw)

  File "/usr/share/subversion/hook-scripts/mailer/mailer.py", line 80, in main
    revision = int(cmd_args[0])

ValueError: invalid literal for int() with base 10: ''

./post-commit.test: 5: ../: Permission denied

I am not sure why cmd_args[0] is empty if I am passing it a value.

#!/bin/sh
REPOS="$1"
REV="$2"
/usr/share/subversion/hook-scripts/mailer/mailer.py commit "$REPOS" \
        "$REV" /usr/share/subversion/hook-scripts/mailer/mailer.conf

Best Answer

permissions should not be set for working copy, but for repository access. Also execution right for the script should be set by user running svn server (or httpd server - depending on your solution).

From the error above looks like user running the script doesn't have direct repository access and cannot get revision number..

m

Related Topic