[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Ryan Schmidt <subversion-2015_at_ryandesign.com>
Date: Wed, 2 Dec 2015 01:19:18 -0600

On Dec 1, 2015, at 10:30 AM, foven wrote:

> I'm configuring Phabricator to host a repository and almost everything
> seems to be working. The only issue that I'm currently aware of is
> that commits are never successful. Instead the client always gives a
> message "svn: E165001: Commit blocked by pre-commit hook
> (exit code 255) with no output".
>
> This error seems to occur independent of the actual script. It happens
> when using the default hook installed by Phabricator and also occurs
> with very simple hooks like the following:
>
> #!/bin/sh
>
> echo "testing" >&2
> exit 1
>
> I would expect this script to fail due to the error code and provide
> the error message "testing". Instead I receive the previously
> mentioned error message. If I change the exit code to 0, it still
> fails with the same message. Basically, this happens with any
> pre-commit script, regardless of the script's contents.
>
> Based on a discussion in the #svn IRC channel, I tried the following:
>
> sudo svn mkdir file:///var/repo/SVN/TestFolder -m "Add test folder"
>
> with the following output:
>
> svn: E165001: Commit blocked by pre-commit hook (exit code 1) with output:
> testing
>
> So this implies that the hook can work and may not be at fault at all.
> Normally changes to the repository are made like so:
> svn mkdir svn+ssh://vcs@phabricator.example.com/diffusion/SVN/TestFolder -m "Testing"
>
> This seems to cause the vcs user to sudo to the phd user and run:
>
> svnserve -t --tunnel-user=foven
>
> I really have no idea what is causing this issue at this point.
> It could be some sort of permissions or ownership issue,
> but I've tested the hook like this:
>
> [phd_at_phabricator ~]$ env -i /var/repo/SVN/hooks/pre-commit
> testing
>
> and this:
>
> [phd_at_phabricator ~]$ env - /var/repo/SVN/hooks/pre-commit
> testing
>
> (which I think should be identical) and both ways work.
>
> I can even run the script this way as the tunneled user. I'm not sure
> if this is actually necessary or advised (is it?), but seems to
> indicate that if the script is run as the tunneled user, it shouldn't
> be causing this issue.
>
> I have seen where SELinux has caused this problem for others in the
> past, but SELinux is disabled.

Yes, it sounds like permissions on the script are not correct. The permissions need to be such that the user who is running the script has read and execute permission. If you are using the file:// protocol, then that user is the user running the svn command. If you are using the http:// or https:// protocol, then that user is the user your apache server runs as. If you are using the svn:// protocol, then that user is the user your svnserve process runs as. If you are using the svn+ssh:// protocol, then if I'm not mistaken that user is the user you authenticate with.

Typically it would be enough to "chmod 755 pre-commit". SELinux has additional requirements, but you said that's disabled.
Received on 2015-12-02 08:19:32 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.