You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Daniela Waranie <ty...@gmx.de> on 2009/09/15 12:57:45 UTC

SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Hi all,

i try to setup a pre-commit hook for subversion.

But i get these messages:
<MESSAGE>
Error: Commit failed (details follow):
Error: Commit blocked by pre-commit hook (exit code 255) with no output.
</MESSAGE>
when i try to make a commit with TortoiseSVN.

When i have this:
#!/usr/bin/php5
<?php
exit(0);
?>
in my pre-commit script it should have the exit code 0 and add the file
to the repository. But i always get the above error. Why?

I tried to run the above pre-commit script from the command line with
the same user (as for the subversion/apache is used) it is processed by
PHP well (saying to me i did not enter the arguments - that`s true, that
was my test about :-).

So, from my point of view, the above path (/usr/bin/php5) is correct and
the pre-hook script is called by subversion, and the interpreter starts
working.

To find the problem i changes the settings in all my php.ini files to:
error_log = /tmp/phperror.log
log_errors = On

But after i did a further commit with the above error message in
tortoiseSVN i can not find a phperror.log in my system (find / -type f
-name "phperror.log") at all. This leads me to the conclusion that no
error occured on php runtime.

Why do i get exit code 255?
Any ideas?

Best regards
Daniela Waranie

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395082

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Daniela Waranie <ty...@gmx.de>.
Hi Ryan,

the subversion server was installed using the user "svn".
The apache who is delivering the repositories is running as user "svn".
When executing a php file using the php5 interpreter (/usr/bin/php5)
with the "svn" user it works.

When i do this:

#!/usr/bin/php5

without any code line below the commit process is taking a very long
time (i think the process is waiting for a timeout). I think this is a
indication that the PHP interpreter is started (but waiting for input, i
think).

Another idea?

Best regards
Daniela Waranie
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395389

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Sep 15, 2009, at 07:57, Daniela Waranie wrote:

> i try to setup a pre-commit hook for subversion.
>
> But i get these messages:
> <MESSAGE>
> Error: Commit failed (details follow):
> Error: Commit blocked by pre-commit hook (exit code 255) with no  
> output.
> </MESSAGE>
> when i try to make a commit with TortoiseSVN.
>
> When i have this:
> #!/usr/bin/php5
> <?php
> exit(0);
> ?>
> in my pre-commit script it should have the exit code 0 and add the  
> file
> to the repository. But i always get the above error. Why?

Are pre-commit and /usr/bin/php5 executable by the user who is serving  
the repository?

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395086

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

SOLVED

Posted by Daniela Waranie <ty...@gmx.de>.
Thanks a lot to every one.
Daniela Waranie

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395858

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Daniela Waranie <ty...@gmx.de>.
Hi Andrey,

sorry for the little mistake in my last post.

The script is like this
#!/usr/bin/php5
<?php
exit(0);

But the message is still the same, if i am using exit(0) or exit(1):
<MESSAGE>
Error: Commit failed (details follow):
Error: Commit blocked by pre-commit hook (exit code 255) with no output.
</MESSAGE>

Best regards
Daniela Waranie

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395852

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Andrey Repin <an...@freemail.ru>.
Greetings, Daniela Waranie!

> now the pre-commit file is like this:

> #!/usr/bin/php5
> <?php
> exit(1);

> but i still get the same error.

> Another idea?

exit(0) ? It was there in your last example, and suddenly changed to 1.


--
WBR,
 Andrey Repin (anrdaemon@freemail.ru) 16.09.2009, <16:14>

Sorry for my terrible english...

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395481

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Daniela Waranie <ty...@gmx.de>.
Hi Stein,

> What happens if you execute the script yourself? In the hooks directory, do:
> 
> 	./pre-commit
> 
> and then
> 
> 	echo $?
> 
> The latter should also show 255, the exit code received by svn.
> 
I got:
-sh: ./pre-commit: /usr/bin/php5^M: bad interpreter: Datei oder
Verzeichnis nicht gefunden

I was wondering.

This leads me to the conclusion that i have used windows line breaks in
this file. After changing that the line breakes to unix style it works.
I get the expected exit code.

Thanks a lot.

Best regards
Daniela Waranie

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395856

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Stein Somers <ss...@opnet.com>.
What happens if you execute the script yourself? In the hooks directory, do:

	./pre-commit

and then

	echo $?

The latter should also show 255, the exit code received by svn.

-- 
Stein

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395417

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Daniela Waranie <ty...@gmx.de>.
Hi Andrey,

now the pre-commit file is like this:

#!/usr/bin/php5
<?php
exit(1);

but i still get the same error.

Another idea?

Best regards
Daniela Waranie

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395379

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Andrey Repin <an...@freemail.ru>.
Greetings, Velu!

> I am a new bie to svn setup. I am trying to setup a remote svn server on
> WinXP.
> I am able to connect to SVN from a remote SVN client(TortoiseSVN) . Here are
> my questions:

> 1. After i start the svnserver, do i need to open any ports on router?
> 2. Should the repository be accessible through a webserver like apache
> http,etc..

If you are starting a new subject, click "New message", not "reply to".
Show at least little respect to potential readers of your message.


--
WBR,
 Andrey Repin (anrdaemon@freemail.ru) 15.09.2009, <19:22>

Sorry for my terrible english...

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395123

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Bogdan Cristea <cr...@gmail.com>.
On Tuesday 15 September 2009 18:09:44 you wrote:
> 1. After i start the svnserver, do i need to open any ports on router?
Not on the router, but on the firewall of the server where the svn server is 
installed. Which port depends how the svn server is configured: using its own 
protocol or http, https, etc. The configuration of svn server is easier when 
using svn own protocol.

> 2. Should the repository be accessible through a webserver like apache
> http,etc..
> 
It depends of your needs. If you have security issues, you could either use 
ssh + svn or https. Take a look at svn help book.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395120

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Velu <na...@gmail.com>.
Hi,

I am a new bie to svn setup. I am trying to setup a remote svn server on
WinXP.
I am able to connect to SVN from a remote SVN client(TortoiseSVN) . Here are
my questions:

1. After i start the svnserver, do i need to open any ports on router?
2. Should the repository be accessible through a webserver like apache
http,etc..

Thanks in advance.

Thanks,
Anand

On Tue, Sep 15, 2009 at 9:41 AM, Andrey Repin <an...@freemail.ru> wrote:

> Greetings, Daniela Waranie!
>
> > When i have this:
> > #!/usr/bin/php5
> > <?php
> > exit(0);
> > ?>
>
> Always, I mean, ALWAYS omit the closing "?>" is you are not intend to
> include
> any output other than provided by script itself.
>
> Try it and see if it works.
>
>
> --
> WBR,
>  Andrey Repin (anrdaemon@freemail.ru) 15.09.2009, <18:39>
>
> Sorry for my terrible english...
>
> ------------------------------------------------------
>
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395111
>
> To unsubscribe from this discussion, e-mail: [
> users-unsubscribe@subversion.tigris.org].
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395119

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: SVN Hook (pre-commit): Commit failed, but why? PHP exit code 255, why?

Posted by Andrey Repin <an...@freemail.ru>.
Greetings, Daniela Waranie!

> When i have this:
> #!/usr/bin/php5
> <?php
> exit(0);
> ?>

Always, I mean, ALWAYS omit the closing "?>" is you are not intend to include
any output other than provided by script itself.

Try it and see if it works.


--
WBR,
 Andrey Repin (anrdaemon@freemail.ru) 15.09.2009, <18:39>

Sorry for my terrible english...

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395111

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].