Post-commit hook failed

8.3k views Asked by At

We are working on sending email notifications of SVN commits and we are following the steps oulined here: http://sandilands.info/sgordon/email-notifications-of-svn-commits

When testing, we get following errors:

Error: post-commit hook failed (exit code 127) with output:
Error: /repos/cle/hooks/post-commit: 50: commit-email.pl: not found
Error: /repos/cle/hooks/post-commit: 51: log-commit.py: not found

Anyone wish to share their experiences?

2

There are 2 answers

0
David W. On

You might want to look at my SVN Watcher post-commit hook script. It will send out an email on commit, but will allow you to configure your watch to specify what files you're interested in. Plus, all users can create a watch list of files they're interested when a commit happens.

The error message is pretty straight forward: It can't find the the named scripts (and you probably only want to use the Perl version or the Python version, but not both. The error could be caused by multiple issues:

  • Incorrect PATH set. Subversion mucks with the environment and shell variables may not be set. This includes PATH which might be set to a default value.
  • The Perl and Python script may not have the executable bit set for the user who is executing the hook.
  • The Perl and Python script may have a bad processor line (for example, Perl is installed in /usr/bin/perl, but your first line is #! /usr/local/bin/perl).
  • The Perl or Python interpreter may not be in your path.

If post-commit is a shell script, add set -xv and export PS4="\$LINENO: on the top. This will print out debugging information, so you can see what's going on in your script. This will only print out if the shell script fails.

0
crashmstr On

Looks like it can't find (and thus cannot execute) commit-email.pl and log-commit.py. You either need those in the path or specified with a full path when calling (as well as making sure you even have these).