You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Andreas Adelsberger | [amp] - Adelsberger Media Productions" <of...@a-m-p.at> on 2006/04/11 05:21:36 UTC

post-commit hook not working

hi!

my post-commit hook doesn't get executed!

here is my post-commit:


/usr/bin/svn export http://svnserver/testrepository 
/var/www/html/testrepository


if I start it manually with
./post-commit
everything works fine, but If I do a commit with toroisesvn, I don't get 
errors but the hook script is not fired.

any ideas how i can fix that, the permissions seem to be correct.

thanx a lot
andi a


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit hook not working

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 12, 2006, at 07:12, Andreas Adelsberger | [amp] - Adelsberger  
Media Productions wrote:

> to 2: the path stuff is not my problem. the script would produce an  
> error if there is something wrong with it, but it simply doesn't  
> get executed. is there a way to disable post-commit in subversion  
> gernerally?

I agree that the path stuff is not the problem in your case. However,  
if the hook has a syntax error or other problem, you will not learn  
about it unless you have explicitly programmed some logging into your  
script. Any output produced by the post-commit hook, whether it be to  
stdout or stderr, is discarded. The exit code of the post-commit hook  
is also not used for anything. The only way to discover whether your  
post-commit hook script is running is by putting strategically-placed  
echo statements like "echo About to do the export... >> /tmp/ 
hook.log" within the script to see how far you get.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit hook not working

Posted by "Andreas Adelsberger | [amp] - Adelsberger Media Productions" <of...@a-m-p.at>.
to 1: i used the templates in the hook directory. I copied 
post-commit.tmpl to post-commit, then chmod +x. the strange thing is 
that the start-commit gets fired.

to 2: the path stuff is not my problem. the script would produce an 
error if there is something wrong with it, but it simply doesn't get 
executed. is there a way to disable post-commit in subversion gernerally?

Rahul Bhargava schrieb:
> Hi:
> 
> 1. Have you installed the hook in your repos/hook dir ?
> 2.  From SVN manual: For security reasons, the Subversion repository
> executes hook scripts with an empty environment-that is, no environment
> variables are set at all, not even $PATH or %PATH%. Because of this, a lot
> of administrators are baffled when their hook script runs fine by hand, but
> doesn't work when run by Subversion. Be sure to explicitly set environment
> variables in your hook and/or use absolute paths to programs.
> 
> 
> Rahul Bhargava
> Subversion, CVS Solutions
> http://www.wandisco.com
> 
> ----- Original Message -----
> From: "Andreas Adelsberger | [amp] - Adelsberger Media Productions"
> <of...@a-m-p.at>
> To: <us...@subversion.tigris.org>
> Sent: Monday, April 10, 2006 10:21 PM
> Subject: post-commit hook not working
> 
> 
>> hi!
>>
>> my post-commit hook doesn't get executed!
>>
>> here is my post-commit:
>>
>>
>> /usr/bin/svn export http://svnserver/testrepository
>> /var/www/html/testrepository
>>
>>
>> if I start it manually with
>> ./post-commit
>> everything works fine, but If I do a commit with toroisesvn, I don't get
>> errors but the hook script is not fired.
>>
>> any ideas how i can fix that, the permissions seem to be correct.
>>
>> thanx a lot
>> andi a
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>> For additional commands, e-mail: users-help@subversion.tigris.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit hook not working

Posted by Rahul Bhargava <ra...@wandisco.com>.
Hi:

1. Have you installed the hook in your repos/hook dir ?
2.  From SVN manual: For security reasons, the Subversion repository
executes hook scripts with an empty environment-that is, no environment
variables are set at all, not even $PATH or %PATH%. Because of this, a lot
of administrators are baffled when their hook script runs fine by hand, but
doesn't work when run by Subversion. Be sure to explicitly set environment
variables in your hook and/or use absolute paths to programs.


Rahul Bhargava
Subversion, CVS Solutions
http://www.wandisco.com

----- Original Message -----
From: "Andreas Adelsberger | [amp] - Adelsberger Media Productions"
<of...@a-m-p.at>
To: <us...@subversion.tigris.org>
Sent: Monday, April 10, 2006 10:21 PM
Subject: post-commit hook not working


> hi!
>
> my post-commit hook doesn't get executed!
>
> here is my post-commit:
>
>
> /usr/bin/svn export http://svnserver/testrepository
> /var/www/html/testrepository
>
>
> if I start it manually with
> ./post-commit
> everything works fine, but If I do a commit with toroisesvn, I don't get
> errors but the hook script is not fired.
>
> any ideas how i can fix that, the permissions seem to be correct.
>
> thanx a lot
> andi a
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit hook not working

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 12, 2006, at 06:50, Andreas Adelsberger | [amp] - Adelsberger  
Media Productions wrote:

>>> here is my post-commit:
>>>
>>> /usr/bin/svn export http://svnserver/testrepository /var/www/html/ 
>>> testrepository
>>>
>>> if I start it manually with
>>> ./post-commit
>>> everything works fine, but If I do a commit with toroisesvn, I  
>>> don't get errors but the hook script is not fired.
>>
>> Perhaps your repository requires authentication? If so, the hook  
>> wouldn't know as whom to authenticate, and would fail. You can  
>> pass a username and password to the svn command with the -- 
>> username and --password arguments.
>
> I don't think it can be an authentication issue becaue it doesn't  
> make a difference if I make a commit as root or as a valid svn user 
> (apache does the authentication for me). the strange thing is that  
> for example a start-commit hook gets executed.

Let me put it a different way. Subversion is executing your post- 
commit script. It encounters the line quoted above, which is supposed  
to export the repository to some directory. This act of connecting to  
the repository to perform the export perhaps requires authentication?  
Do you allow anyone to check out or export your repository, or must  
one authenticate? If the latter, then the svn command within your  
hook script is trying to start an export, your repository is  
answering that it requires authentication, your hook script doesn't  
know how to provide that to the repository, and so nothing happens.  
When you start it manually on the command line, it's likely using  
your cached credentials in your .subversion directory in your home  
directory, so you don't see the problem there.

Another possibility is that the user under which Apache runs does not  
have a home directory, or if it does, that it does not have  
a .subversion directory, and that this may be required. So try making  
it.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit hook not working

Posted by "Andreas Adelsberger | [amp] - Adelsberger Media Productions" <of...@a-m-p.at>.
I don't think it can be an authentication issue becaue it doesn't make a 
difference if I make a commit as root or as a valid svn user(apache does 
the authentication for me). the strange thing is that for example a 
start-commit hook gets executed.

Ryan Schmidt schrieb:
> On Apr 11, 2006, at 07:21, Andreas Adelsberger | [amp] - Adelsberger 
> Media Productions wrote:
> 
>> my post-commit hook doesn't get executed!
>>
>> here is my post-commit:
>>
>> /usr/bin/svn export http://svnserver/testrepository 
>> /var/www/html/testrepository
>>
>>
>> if I start it manually with
>> ./post-commit
>> everything works fine, but If I do a commit with toroisesvn, I don't 
>> get errors but the hook script is not fired.
> 
> Perhaps your repository requires authentication? If so, the hook 
> wouldn't know as whom to authenticate, and would fail. You can pass a 
> username and password to the svn command with the --username and 
> --password arguments.
> 
> 
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit hook not working

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 11, 2006, at 07:21, Andreas Adelsberger | [amp] - Adelsberger  
Media Productions wrote:

> my post-commit hook doesn't get executed!
>
> here is my post-commit:
>
> /usr/bin/svn export http://svnserver/testrepository /var/www/html/ 
> testrepository
>
>
> if I start it manually with
> ./post-commit
> everything works fine, but If I do a commit with toroisesvn, I  
> don't get errors but the hook script is not fired.

Perhaps your repository requires authentication? If so, the hook  
wouldn't know as whom to authenticate, and would fail. You can pass a  
username and password to the svn command with the --username and -- 
password arguments.





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org