2
votes

I have a Centos 7 virtual machine (VirtualBox guest) that is acting as my svn server, already configured svn -- mod_dav_svn and got everything working fine: can checkout and do commits. The problem is that when adding a pre-commit hook and then try to commit from a windows machine (VirtualBox host) TortoiseSVN fails with this error

Commit blocked by pre-commit hook (exit code 255) with no output.

from the httpd logs I got

[client xx.xx.xx.xxx:57] Could not MERGE resource "/svn/testrepo/!svn/txn/5-2f" into "/svn/testrepo/trunk". [500, #0]

all the permissions are set correctly, I even try 777 and it is not working unless I remove the hook.

This is the reference I followed for the set up: http://www.unixmen.com/install-subversion-centos-7/

I'm wondering if there's something missing in my 10-subversion.conf file...

I'm using the default pre-commit, which has been set already as executable and the owner is apache user. Another test I did was to delete all the code in the pre-commit script leaving only the "exit 0" instruction.

This is how my 10-subversion.conf file looks like:

    LoadModule dav_svn_module     modules/mod_dav_svn.so
    LoadModule authz_svn_module   modules/mod_authz_svn.so
    LoadModule dontdothat_module  modules/mod_dontdothat.so

    <Location /svn>
       DAV svn
       SVNParentPath /var/www/svn
       AuthType Basic
       AuthName "Subversion repositories"
       AuthUserFile /etc/svn-auth-users
       Require valid-user
    </Location>
CustomLog logs/svn_logfile "%t %u %{SVN-ACTION}e" env=SVN-ACTION
2
you should at least add the code of the hook script (and what it should do..).Peter Parker
it is just the default pre-commit... it checks if there are comments and if the user can commit, I also tried removing all the code except the "exit 0" line.Ricardo Alfaro

2 Answers

6
votes

Finally got a solution for this. The root cause was the SELinux not allowing the pre-commit script to get executed through the httpd service. I get rid of that by running this line

chcon -t httpd_exec_t pre-commit

Thanks everyone! I hope this to be helpful for someone else.

2
votes

can you post your precommit script? If not, add following to your ".sh" script.

set -xv

at the line after

#!/bin/bash

looks finally:

#!/bin/bash
set -xv

If this does not provide you more logging, redirect the outputs to a file in your script. So you can debug your script.

You can also increase the logging in your apache. Check this http://svnbook.red-bean.com/en/1.6/svn.serverconfig.httpd.html#svn.serverconfig.httpd.extra.logging

So you will get one file only for SVN and you can play also with the log level.

I would personally first try, since easier the change of the script.

(for your next question, please be more specific)