You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Anthony Lieuallen <ar...@gmail.com> on 2008/05/02 01:32:21 UTC

post-commit hook completely fails

I've done all I can to diagnose this, and I can't figure it out.  I've 
set up hooks just fine on at least two other different systems, but here 
nothing works.

So I create a test repository:

$ uname -a
Linux maniac 2.6.18-hardened #3 SMP Thu Mar 15 23:20:05 EDT 2007 x86_64 
AMD Sempron(tm) Processor 2800+ AuthenticAMD GNU/Linux
$ grep User /etc/apache2/httpd.conf
User apache
$ cd /tmp
$ svnadmin create svn
$ sudo chown -R apache:apache svn
$ sudo chmod -R og+w svn
$ cd svn/hooks/
$ cat > post-commit
#!/bin/bash
/bin/true
$ chmod 777 post-commit


And I set it up via apache:


<VirtualHost 65.111.171.224:80>
         ServerName svn2
         DocumentRoot /tmp
         ErrorLog /tmp/error_log
         CustomLog /tmp/access combined

         <Directory /tmp>
                 Order allow,deny
                 Allow from all
         </Directory>

         <Location />
                 DAV svn
                 SVNPath /tmp/svn
         </Location>
</VirtualHost>


And then:


$ svn co http://svn2/ test
Checked out revision 0.
$ cd test/
$ touch x
$ svn add x
A         x
$ svn ci -m -
Adding         x
Transmitting file data .
Committed revision 1.

Warning: 'post-commit' hook failed with error output:


What else can I do?  It's completely failing.  If I completely remove 
the post-commit file, it runs cleanly, but if *anything* is there, it 
fails with no message.

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

Re: post-commit hook completely fails

Posted by Miha Vitorovic <mv...@nil.si>.
Hooks have no environment. The system does not know where to find 'cat' 
(or 'echo' for that matter). Use '/bin/cat' or '/bin/echo' instead.

Br,
---
  Miha Vitorovic
  Inženir v tehničnem področju
  Customer Support Engineer

   NIL Data Communications,  Tivolska cesta 48,  1000 Ljubljana,  Slovenia
   Phone +386 1 4746 500      Fax +386 1 4746 501     http://www.NIL.si



Marc Haisenko <ha...@comdasys.com> 
06.05.2008 11:52

To
users@subversion.tigris.org
cc
"Puneet Lakhina" <pu...@gmail.com>, "Anthony Lieuallen" 
<ar...@gmail.com>
Subject
Re: post-commit hook completely fails






On Tuesday 06 May 2008, Puneet Lakhina wrote:
> You could do a simple
>
> $ cat "I am running" >> /somewriteableDirectory/postcommitop.txt
>
> in your hook file and see if the file gets this line. This will atleast
> assure that your hook file is running.

Please make that "echo" instead of "cat" :-) I doubt there's a file called 
"I 
am running" around ;-)

BTW, for such debugging I do things like this:
$ date >>/tmp/debug.log

That way I not only know it happened but also when.
                 Marc





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


Re: post-commit hook completely fails

Posted by Marc Haisenko <ha...@comdasys.com>.
On Tuesday 06 May 2008, Puneet Lakhina wrote:
> You could do a simple
>
> $ cat "I am running" >> /somewriteableDirectory/postcommitop.txt
>
> in your hook file and see if the file gets this line. This will atleast
> assure that your hook file is running.

Please make that "echo" instead of "cat" :-) I doubt there's a file called "I 
am running" around ;-)

BTW, for such debugging I do things like this:
$ date >>/tmp/debug.log

That way I not only know it happened but also when.
	Marc

-- 
Marc Haisenko

Comdasys AG
Rüdesheimer Str. 7
80686 München
Germany

Tel.: +49 (0)89 548 433 321

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

Re: post-commit hook completely fails

Posted by Puneet Lakhina <pu...@gmail.com>.
On Tue, May 6, 2008 at 7:09 AM, Anthony Lieuallen <ar...@gmail.com>
wrote:

> On 5/1/2008 9:32 PM, Anthony Lieuallen wrote:
>
> > $ cat > post-commit
> > #!/bin/bash
> > /bin/true
> > $ chmod 777 post-commit
> >
>
> I hate to do this but .. bump?
>
> I can't make this script any simpler, but it still does not run.  How do I
> get debugging information to figure this out?  Nothing shows in any output
> or log I can find.
>

You could do a simple

$ cat "I am running" >> /somewriteableDirectory/postcommitop.txt

in your hook file and see if the file gets this line. This will atleast
assure that your hook file is running.


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


-- 
Puneet
http://sahyog.blogspot.com/
Latest Post: javac -g

Re: post-commit hook completely fails

Posted by Paul Koning <Pa...@dell.com>.
For me, most of the time debugging hooks starts with a look int e
Apache logs, in particular the errors log.  That will often point me
to the issue without adding any debug output to the hook.

Does that say anything in this case?

     paul


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

Re: post-commit hook completely fails

Posted by Wouter van der Horst <w....@gmail.com>.
Have you tried to output a message to stderr and then exit the script
with a non-zero exit code?

for example:

# echo "I'm doing it wrong" >&2
# exit 1

What happens if you do that?

(I haven't read all your previous posts so I apologize if you've
covered that already.)

Wouter

On Tue, May 6, 2008 at 6:02 PM, Anthony Lieuallen <ar...@gmail.com> wrote:
> On 5/6/2008 12:00 PM, Wouter van der Horst wrote:
>
> > Just to rule out the obvious: Are you sure the post-commit hook you
> > are looking at is the post-commit hook that's being run? In other
> > words, are you looking in the right repository?
> >
>
>  Yes, I specifically created a repository only for testing this issue. It
> also happens no matter what the repository is.
>
>  I.E. These steps have happened:  Repository has no hook files.  Commit, no
> error.  Create a simple one (even just ln -s /bin/true post-commit), commit,
> I'm given an error with no output.
>

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

Re: post-commit hook completely fails

Posted by Wouter van der Horst <w....@gmail.com>.
Just to rule out the obvious: Are you sure the post-commit hook
you are looking at is the post-commit hook that's being run? In other words,
are you looking in the right repository?

On Tue, May 6, 2008 at 3:51 PM, Anthony Lieuallen <ar...@gmail.com> wrote:
> On 5/5/2008 9:50 PM, Karl Fogel wrote:
>
> > How can you tell it is not running if all it does is invoke /bin/true?
> >
>
>  Good point.  I've tried sending text to logs in the past is how I know, to
> be honest.  So to repeat and be clear:
>
>
>  $ cat > post-commit
>  #!/bin/bash
>  /bin/date >> /tmp/pc.txt
>
>  /bin/true
>  $ chmod 777 post-commit
>
>  Still:
>
>  Transmitting file data .
>  Committed revision 5.
>
>  Warning: 'post-commit' hook failed with error output:
>
>  And on the host:
>
>  $ ls -l /tmp/pc.txt
>  ls: cannot access /tmp/pc.txt: No such file or directory
>
>  The file doesn't exist.  If I run that script manually, it works.  Even if
> I run it as the apache user, and with "env -".
>
>  Like I said much earlier, if there is no "post-commit" file, I get no
> error.  But if there is anything there, an empty shell script, a symlink to
> /bin/true, anything .. I get the "failed with error output" with no error
> output message.  Something is failing, but I don't know what, and I don't
> know how to diagnose what.
>
>  P.S. To others in this thread: echo is a builtin of bash, so since this is
> a bash script, the path to echo wouldn't really need to be supplied.
>
>
>
>  ---------------------------------------------------------------------
>  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 completely fails

Posted by Anthony Lieuallen <ar...@gmail.com>.
On 5/5/2008 9:50 PM, Karl Fogel wrote:
> How can you tell it is not running if all it does is invoke /bin/true?

Good point.  I've tried sending text to logs in the past is how I know, 
to be honest.  So to repeat and be clear:

$ cat > post-commit
#!/bin/bash
/bin/date >> /tmp/pc.txt
/bin/true
$ chmod 777 post-commit

Still:

Transmitting file data .
Committed revision 5.

Warning: 'post-commit' hook failed with error output:

And on the host:

$ ls -l /tmp/pc.txt
ls: cannot access /tmp/pc.txt: No such file or directory

The file doesn't exist.  If I run that script manually, it works.  Even 
if I run it as the apache user, and with "env -".

Like I said much earlier, if there is no "post-commit" file, I get no 
error.  But if there is anything there, an empty shell script, a symlink 
to /bin/true, anything .. I get the "failed with error output" with no 
error output message.  Something is failing, but I don't know what, and 
I don't know how to diagnose what.

P.S. To others in this thread: echo is a builtin of bash, so since this 
is a bash script, the path to echo wouldn't really need to be supplied.

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

Re: post-commit hook completely fails

Posted by Karl Fogel <kf...@red-bean.com>.
Anthony Lieuallen <ar...@gmail.com> writes:
> On 5/1/2008 9:32 PM, Anthony Lieuallen wrote:
>> $ cat > post-commit
>> #!/bin/bash
>> /bin/true
>> $ chmod 777 post-commit
>
> I hate to do this but .. bump?
>
> I can't make this script any simpler, but it still does not run.  How
> do I get debugging information to figure this out?  Nothing shows in
> any output or log I can find.

How can you tell it is not running if all it does is invoke /bin/true?

(IOW, show us a transcript of the symptoms.)

-Karl


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

Re: post-commit hook completely fails

Posted by Anthony Lieuallen <ar...@gmail.com>.
On 5/1/2008 9:32 PM, Anthony Lieuallen wrote:
> $ cat > post-commit
> #!/bin/bash
> /bin/true
> $ chmod 777 post-commit

I hate to do this but .. bump?

I can't make this script any simpler, but it still does not run.  How do 
I get debugging information to figure this out?  Nothing shows in any 
output or log I can find.

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

Re: post-commit hook completely fails

Posted by Anthony Lieuallen <ar...@gmail.com>.
On 5/7/2008 4:45 AM, Ryan Schmidt wrote:
>> You are sure that execution right are set properly? ...

Yep, read my prior posts.  Creating the file named "post commmit" is 
followed immediately by "chmod 777 post-commit" in this test case.

> Are you running SELinux...

Nope.

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

Re: post-commit hook completely fails

Posted by Ryan Schmidt <su...@ryandesign.com>.
On May 7, 2008, at 2:05 AM, Lorenz wrote:

> Anthony Lieuallen wrote:
>> [...]
>> Committed revision 1.
>>
>> Warning: 'post-commit' hook failed with error output:
>
> that is weird!?
> The exit code of a post-anything hook is ignored (as far as I know -
> and I've just put an "exit 1" at the end of the post-commit hook of my
> test repository)

Hmm... Good point...


> You are sure that execution right are set properly? Because can't
> imagine anything besides the hook not being executable at all that
> could cause such effect (but that may originate in lack of imagination
> 8-).

Are you running SELinux and if so have you used chcon to set the  
security context so that the svnserve or apache process can execute  
the hook script? This may be relevant:

http://subversion.tigris.org/faq.html#reposperms



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

Re: post-commit hook completely fails

Posted by Srikanth Vittal <vi...@gmail.com>.
Hi Anthony

Even I have the same problem!!!

Did u manage to fix? If so, please let me know how.

Thanks
Srikanth


Hari Kodungallur-3 wrote:
> 
> On Wed, May 7, 2008 at 12:05 AM, Lorenz <lo...@yahoo.com> wrote:
> 
>> Anthony Lieuallen wrote:
>> >[...]
>> >Committed revision 1.
>> >
>> >Warning: 'post-commit' hook failed with error output:
>>
>> that is weird!?
>> The exit code of a post-anything hook is ignored (as far as I know -
>> and I've just put an "exit 1" at the end of the post-commit hook of my
>> test repository)
> 
> 
> 
> Not completely. Post-anything exit codes only generate warning. The commit
> goes through fine. From what Anthony has shown, the warning is expected
> when
> the hook exited with exit 1 or if it could not execute post-commit.
> 
> But since his post-commit is supposed to have only /bin/true in it, I have
> absolutely no idea what is going on.
> 
> 
> 
>>
>>
>> You are sure that execution right are set properly? Because can't
>> imagine anything besides the hook not being executable at all that
>> could cause such effect (but that may originate in lack of imagination
>> 8-).
>>
> 
> 
> 
> rgds
> -Hari
> 
> 

-- 
View this message in context: http://www.nabble.com/post-commit-hook-completely-fails-tp17012339p17407115.html
Sent from the Subversion Users mailing list archive at Nabble.com.


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

Re: post-commit hook completely fails

Posted by Hari Kodungallur <hk...@gmail.com>.
On Wed, May 7, 2008 at 12:05 AM, Lorenz <lo...@yahoo.com> wrote:

> Anthony Lieuallen wrote:
> >[...]
> >Committed revision 1.
> >
> >Warning: 'post-commit' hook failed with error output:
>
> that is weird!?
> The exit code of a post-anything hook is ignored (as far as I know -
> and I've just put an "exit 1" at the end of the post-commit hook of my
> test repository)



Not completely. Post-anything exit codes only generate warning. The commit
goes through fine. From what Anthony has shown, the warning is expected when
the hook exited with exit 1 or if it could not execute post-commit.

But since his post-commit is supposed to have only /bin/true in it, I have
absolutely no idea what is going on.



>
>
> You are sure that execution right are set properly? Because can't
> imagine anything besides the hook not being executable at all that
> could cause such effect (but that may originate in lack of imagination
> 8-).
>



rgds
-Hari

Re: post-commit hook completely fails

Posted by Lorenz <lo...@yahoo.com>.
Anthony Lieuallen wrote:
>[...]
>Committed revision 1.
>
>Warning: 'post-commit' hook failed with error output:

that is weird!?
The exit code of a post-anything hook is ignored (as far as I know -
and I've just put an "exit 1" at the end of the post-commit hook of my
test repository)

You are sure that execution right are set properly? Because can't
imagine anything besides the hook not being executable at all that
could cause such effect (but that may originate in lack of imagination
8-).
-- 

Lorenz


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

Re: post-commit hook completely fails

Posted by Hari Kodungallur <hk...@gmail.com>.
On Fri, May 2, 2008 at 6:34 AM, Anthony Lieuallen <ar...@gmail.com>
wrote:

> On 5/1/2008 10:16 PM, Srilakshmanan, Lakshman wrote:
>
> > Couple of tests you can perform to narrow the problem.
> > ...
> > I suspect your script is failing with a syntax error, which returns a
> > non-zero to subversion server.
> >
>
> You did see where, in my original mail, I set the entire content of the
> script to:
>
> #!/bin/bash
> /bin/true
>
> ?  I can't make it any simpler than that.  I even did "ln -s /bin/true
> post-commit" and I get exactly the same result.
>
>
When you execute the post-commit from command line, does it throw a non-zero
exit status? [In reality, the post-commit is run without an env, which is
different from running on the command line, but it would be nice to know if
it runs from the command line]

rgds
-Hari

Re: post-commit hook completely fails

Posted by Anthony Lieuallen <ar...@gmail.com>.
On 5/1/2008 10:16 PM, Srilakshmanan, Lakshman wrote:
> Couple of tests you can perform to narrow the problem.
> ...
> I suspect your script is failing with a syntax error, which returns a
> non-zero to subversion server.

You did see where, in my original mail, I set the entire content of the 
script to:

#!/bin/bash
/bin/true

?  I can't make it any simpler than that.  I even did "ln -s /bin/true 
post-commit" and I get exactly the same result.

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

RE: post-commit hook completely fails

Posted by "Srilakshmanan, Lakshman" <la...@police.vic.gov.au>.
Hi Anthony,

Couple of tests you can perform to narrow the problem.

1) place a "exit 0" at the top of your hook file.
2) keep moving the "exit 0" down the file till you can reproduce the
error.

I suspect your script is failing with a syntax error, which returns a
non-zero to subversion server.

Thanks
Lakshman
-----Original Message-----
From: Anthony Lieuallen [mailto:arantius@gmail.com] 
Sent: Friday, 2 May 2008 11:32 AM
To: users@subversion.tigris.org
Subject: post-commit hook completely fails

I've done all I can to diagnose this, and I can't figure it out.  I've
set up hooks just fine on at least two other different systems, but here
nothing works.

So I create a test repository:

$ uname -a
Linux maniac 2.6.18-hardened #3 SMP Thu Mar 15 23:20:05 EDT 2007 x86_64
AMD Sempron(tm) Processor 2800+ AuthenticAMD GNU/Linux $ grep User
/etc/apache2/httpd.conf User apache $ cd /tmp $ svnadmin create svn $
sudo chown -R apache:apache svn $ sudo chmod -R og+w svn $ cd svn/hooks/
$ cat > post-commit #!/bin/bash /bin/true $ chmod 777 post-commit


And I set it up via apache:


<VirtualHost 65.111.171.224:80>
         ServerName svn2
         DocumentRoot /tmp
         ErrorLog /tmp/error_log
         CustomLog /tmp/access combined

         <Directory /tmp>
                 Order allow,deny
                 Allow from all
         </Directory>

         <Location />
                 DAV svn
                 SVNPath /tmp/svn
         </Location>
</VirtualHost>


And then:


$ svn co http://svn2/ test
Checked out revision 0.
$ cd test/
$ touch x
$ svn add x
A         x
$ svn ci -m -
Adding         x
Transmitting file data .
Committed revision 1.

Warning: 'post-commit' hook failed with error output:


What else can I do?  It's completely failing.  If I completely remove 
the post-commit file, it runs cleanly, but if *anything* is there, it 
fails with no message.

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

================================================================================================
EMAIL DISCLAIMER

This email and any attachments are confidential. They may also be subject to copyright.

If you are not an intended recipient of this email please immediately contact us by replying
to this email and then delete this email. 

You must not read, use, copy, retain, forward or disclose this email or any attachment.

We do not accept any liability arising from or in connection with unauthorised use or disclosure 
of the information contained in this email or any attachment.

We make reasonable efforts to protect against computer viruses but we do not accept liability
for any liability, loss or damage caused by any computer virus contained in this email.
================================================================================================

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