You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Michael Pfeiffer <vi...@gmx.de> on 2006/07/09 17:16:10 UTC

"Advanced" problems with post-commit

Hi,

I think it is a very "popular" problem but I can't find a solution for it.

I want to use the post-commit hook and did the following until now:

- renamed post-commit.tmpl to post-commit
- edited it to use absolute paths to commit-email.pl (that is located in the same hook-directory)
- edited commit-email.pl to use absolute paths for sendmail and svnlook
- edited commit-email.pl at the first appearance of $repos, here I had to set the absolute path to my repository directory to let svnlook find there pository handed over as $repos
- made all files executable

Everything works well when I invoke it from command line, the commit emails are sent. But nothing happens when I commit something. What could be the reason for this behavior?

Michael


-- 


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

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

Re: Re: Re: "Advanced" problems with post-commit

Posted by Michael Pfeiffer <vi...@gmx.de>.
Thanks to all people who helped me: removing the fixed path to the repository fixed the thing. Now I can't call it from the command line but from within SVN everything goes well.

-------- Original-Nachricht --------
Datum: Sun, 9 Jul 2006 20:17:44 -0400
Von: Nico Kadel-Garcia <nk...@comcast.net>
An: Michael Pfeiffer <vi...@gmx.de>, Ryan Schmidt <su...@ryandesign.com>
Betreff: Re: Re: "Advanced" problems with post-commit

> Michael Pfeiffer wrote:
> > Hi Ryan,
> >
> > thank you for your fast reply.
> >
> >>> - edited commit-email.pl to use absolute paths for sendmail and
> >>> svnlook
> >>> - edited commit-email.pl at the first appearance of $repos, here I
> >>> had to set the absolute path to my repository directory to let
> >>> svnlook find there pository handed over as $repos
> >>
> >> I'm not sure why you're having to edit commit-email.pl. It's supposed
> >> to be a self-contained script that just works.
> >
> > When I don't set the absolute path it doesn't finds the repository
> > when I call it from command line. May be thats because I use an own,
> > specific path where the reops are located at?
> 
> Oh, *that's* easy. Check it by having a post-commit or pre-commit script 
> write a lgo somewhere, but check out what `dirname $0` yields you as far
> as 
> the "hooks" directory used fo rthe pre-commit script itslelf and use the 
> results to prefix the call of any other scripts in the "hooks" directory
> or 
> any configuration files in $REPODIR/conf.
> 
> >> If you run "env -i ./post-commit" on the command line, does it still
> >> work? "env -i" ignores environment variables. So if it then fails to
> >> work, you may still have relative paths around somewhere.
> >
> > That works - at least when I have this abolute repository path thingy
> > inside the script.
> >
> >> Another possibility: make sure the user under which your repository
> >> runs (for example the apache user if you're serving under apache) has
> >> the ability to read and execute the hook script and the commit-email
> >> script.
> >
> > Yes, the user is privileged to do that.
> >
> > Michael 

-- 


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

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

Re: Re: "Advanced" problems with post-commit

Posted by Nico Kadel-Garcia <nk...@comcast.net>.
Michael Pfeiffer wrote:
> Hi Ryan,
>
> thank you for your fast reply.
>
>>> - edited commit-email.pl to use absolute paths for sendmail and
>>> svnlook
>>> - edited commit-email.pl at the first appearance of $repos, here I
>>> had to set the absolute path to my repository directory to let
>>> svnlook find there pository handed over as $repos
>>
>> I'm not sure why you're having to edit commit-email.pl. It's supposed
>> to be a self-contained script that just works.
>
> When I don't set the absolute path it doesn't finds the repository
> when I call it from command line. May be thats because I use an own,
> specific path where the reops are located at?

Oh, *that's* easy. Check it by having a post-commit or pre-commit script 
write a lgo somewhere, but check out what `dirname $0` yields you as far as 
the "hooks" directory used fo rthe pre-commit script itslelf and use the 
results to prefix the call of any other scripts in the "hooks" directory or 
any configuration files in $REPODIR/conf.

>> If you run "env -i ./post-commit" on the command line, does it still
>> work? "env -i" ignores environment variables. So if it then fails to
>> work, you may still have relative paths around somewhere.
>
> That works - at least when I have this abolute repository path thingy
> inside the script.
>
>> Another possibility: make sure the user under which your repository
>> runs (for example the apache user if you're serving under apache) has
>> the ability to read and execute the hook script and the commit-email
>> script.
>
> Yes, the user is privileged to do that.
>
> Michael 

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

Re: Re: "Advanced" problems with post-commit

Posted by Bob Proulx <bo...@proulx.com>.
Michael Pfeiffer wrote:
> Ryan Schmidt wrote:
> > > - edited commit-email.pl to use absolute paths for sendmail and  
> > > svnlook

Those scripts already have the absolute paths for sendmail and
svnlook.  You should not need to do this *again*.  This makes me
wonder what version of subversion you are actually using?  Because if
you are needing to do this then you must be using a different version
than one that us on the mailing list would consider a good one.

Here is what I see in my copy of commit-email.pl:

  # Sendmail path.
  my $sendmail = "/usr/sbin/sendmail";

  # Svnlook path.
  my $svnlook = "/usr/bin/svnlook";

Why is yours different?

> > > - edited commit-email.pl at the first appearance of $repos, here I  
> > > had to set the absolute path to my repository directory to let  
> > > svnlook find there pository handed over as $repos
> > 
> > I'm not sure why you're having to edit commit-email.pl. It's supposed  
> > to be a self-contained script that just works.

Agreed.  The $repos is passed into the script by the post-commit hook
script.  If you are modifying it then what happens when the passed in
"$REPOS" argument is passed in?

> When I don't set the absolute path it doesn't finds the repository
> when I call it from command line. May be thats because I use an own,
> specific path where the reops are located at?

Perhaps you are trying to invoke the post-commit script differently
than subversion is trying to invoke it?  You should test using the
same arguments.  This is in the example post-commit.tmpl file:

  REPOS="$1"
  REV="$2"

  /usr/lib/subversion/hook-scripts/commit-email.pl "$REPOS" "$REV" commit-watchers@example.org

> > If you run "env -i ./post-commit" on the command line, does it still  
> > work? "env -i" ignores environment variables. So if it then fails to  
> > work, you may still have relative paths around somewhere.

I think you need these arguments:

  env -i post-commit $REPOS $REV 

For example:

  env -i post-commit /srv/svn/myproj 42

> That works - at least when I have this abolute repository path
> thingy inside the script.

Then that must be the problem.  You need to invoke it when testing
with the path to the repository and the revision number.

Bob

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

Re: Re: "Advanced" problems with post-commit

Posted by Michael Pfeiffer <vi...@gmx.de>.
Hi Ryan,

thank you for your fast reply.

> > - edited commit-email.pl to use absolute paths for sendmail and  
> > svnlook
> > - edited commit-email.pl at the first appearance of $repos, here I  
> > had to set the absolute path to my repository directory to let  
> > svnlook find there pository handed over as $repos
> 
> I'm not sure why you're having to edit commit-email.pl. It's supposed  
> to be a self-contained script that just works.

When I don't set the absolute path it doesn't finds the repository when I call it from command line. May be thats because I use an own, specific path where the reops are located at?

> If you run "env -i ./post-commit" on the command line, does it still  
> work? "env -i" ignores environment variables. So if it then fails to  
> work, you may still have relative paths around somewhere.

That works - at least when I have this abolute repository path thingy inside the script.

> Another possibility: make sure the user under which your repository  
> runs (for example the apache user if you're serving under apache) has  
> the ability to read and execute the hook script and the commit-email  
> script.

Yes, the user is privileged to do that.

Michael

-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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

Re: "Advanced" problems with post-commit

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jul 9, 2006, at 19:16, Michael Pfeiffer wrote:

> I want to use the post-commit hook and did the following until now:
>
> - renamed post-commit.tmpl to post-commit
> - edited it to use absolute paths to commit-email.pl (that is  
> located in the same hook-directory)

> - made all files executable

Sounds good to me.

> - edited commit-email.pl to use absolute paths for sendmail and  
> svnlook
> - edited commit-email.pl at the first appearance of $repos, here I  
> had to set the absolute path to my repository directory to let  
> svnlook find there pository handed over as $repos

I'm not sure why you're having to edit commit-email.pl. It's supposed  
to be a self-contained script that just works. It already uses the  
absolute path to sendmail (/usr/sbin/sendmail -- ok, if your sendmail  
is in a different place then I'd understand why you had to edit it)  
and svnlook (@SVN_BINDIR@/svnlook, where @SVN_BINDIR@ is replaced  
during installation with the correct value). $repos also looks like  
it is taken from the argument passed to the script, so you should not  
need to change the way it's used in the script; you should just pass  
your repository path to the script, exactly as the example shows:

commit-email.pl "$REPOS" "$REV" commit-watchers@example.org

If you run "env -i ./post-commit" on the command line, does it still  
work? "env -i" ignores environment variables. So if it then fails to  
work, you may still have relative paths around somewhere.

Another possibility: make sure the user under which your repository  
runs (for example the apache user if you're serving under apache) has  
the ability to read and execute the hook script and the commit-email  
script.


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