You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Célio Cidral Junior <cc...@gmail.com> on 2005/07/12 11:28:55 UTC

Hook script doesn't work

Hi!

I have put a hook script in my repo's hooks directory to allow users
to change the commit log message and deny any other revision property
change. The script is a very simple batch file, however it doesn't
work. It seems to be correct and I can't figure out what might be
wrong. If I put an empty script, it works fine, but in the other hand
it allows any revision property change (including author change). The
hook script is attached (note that I removed the .bat extension
because of anti-virus mail blocking). The error message I have got is
this:

"DAV request failed; it's possible that the repository's
pre-revprop-change hook either failed or is non-existent
At least one property change failed; repository is unchanged"

My machine runs Windows XP SP-2, Apache 2.0 and Subversion 1.1.4. The
problem happens with both TortoiseSVN and svn command line clients.

Best regards,

Celio Cidral Junior
WEG Eletric
http://www.weg.com.br

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


Re: Hook script doesn't work

Posted by Célio Cidral Junior <cc...@gmail.com>.
I found what is problem. When you do not authenticate the user at
Apache (via configuration), the number of parameters passed into the
hook script is 3, and when you do the authentication, the number of
parameters is 4. Thus, your hook script have to consider whether the
user is being authenticated or not by checking the number of
parameters, so you will get a different parameter position for the
property name parameter.

I attached the source code of the hook script I have wrote. I would
like to improve it so that only the user who commited the revision
could change the log message of such revision. But, since I'm not a
C/C++ guru, I leave it to others who are willing to handle it.

Thanks,

Celio Cidral Jr

2005/7/12, Célio Cidral Junior <cc...@gmail.com>:
> I have wrote a little C++ application to do the job and have put it in
> the place of the batch file. I also have set a valid user to Apache's
> service so now its process have all rights needed to execute the hook
> script. However, it remains failing as before. I attached the app's
> source file. I compiled it using the free Borland C++ compiler. Note
> that is does not depend upon the PATH env var.
> 
> 2005/7/12, Gábor Szabó <sz...@gmail.com>:
> > On 7/12/05, Célio Cidral Junior <cc...@gmail.com> wrote:
> > > I tested it both via http:// and file:// access, and noticed that it
> > > works only via file://
> > >
> > > What can be wrong here?
> >
> > use rights, missing or different environment variables ?
> >
> > Your Apache runs as a different user and has a different environment
> > that where you tested. (e.g. PATH is different)
> >
> > Gabor
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> > For additional commands, e-mail: users-help@subversion.tigris.org
> >
> >
> 
> 
> --
> Celio Cidral Junior
> WEG Eletric
> http://www.weg.com.br
> 
> 
> 


-- 
Celio Cidral Junior
WEG Eletric
http://www.weg.com.br

Re: Hook script doesn't work

Posted by Célio Cidral Junior <cc...@gmail.com>.
I have wrote a little C++ application to do the job and have put it in
the place of the batch file. I also have set a valid user to Apache's
service so now its process have all rights needed to execute the hook
script. However, it remains failing as before. I attached the app's
source file. I compiled it using the free Borland C++ compiler. Note
that is does not depend upon the PATH env var.

2005/7/12, Gábor Szabó <sz...@gmail.com>:
> On 7/12/05, Célio Cidral Junior <cc...@gmail.com> wrote:
> > I tested it both via http:// and file:// access, and noticed that it
> > works only via file://
> >
> > What can be wrong here?
> 
> use rights, missing or different environment variables ?
> 
> Your Apache runs as a different user and has a different environment
> that where you tested. (e.g. PATH is different)
> 
> Gabor
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
> 


-- 
Celio Cidral Junior
WEG Eletric
http://www.weg.com.br

Re: Hook script doesn't work

Posted by Gábor Szabó <sz...@gmail.com>.
On 7/12/05, Célio Cidral Junior <cc...@gmail.com> wrote:
> I tested it both via http:// and file:// access, and noticed that it
> works only via file://
> 
> What can be wrong here?

use rights, missing or different environment variables ?

Your Apache runs as a different user and has a different environment
that where you tested. (e.g. PATH is different)

Gabor

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


Re: Hook script doesn't work

Posted by Célio Cidral Junior <cc...@gmail.com>.
I tested it both via http:// and file:// access, and noticed that it
works only via file://

What can be wrong here?

2005/7/12, Johan Appelgren <jo...@gmail.com>:
> On 7/12/05, Célio Cidral Junior <cc...@gmail.com> wrote:
> > Oh, I forgot it. Sorry :-P ... You can see it now.
> >
> > 2005/7/12, Norbert Unterberg <nu...@gmail.com>:
> > > 2005/7/12, Célio Cidral Junior <cc...@gmail.com>:
> > >
> > > > The
> > > > hook script is attached (note that I removed the .bat extension
> > > > because of anti-virus mail blocking).
> > >
> > > Hmm, where is the hook script? There is no script attached to your mail.
> > >
> 
> Used your batch file and for me it works just fine. The only thing
> missing is that the error message is echoed to stdout instead of
> stderr. Only text on stderr is forwarded to the client.
> 
> Add >&2 like this to echo to stderr:
> echo Property '%PROPNAME%' cannot be changed. >&2
> 
> /Johan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
> 


-- 
Celio Cidral Junior
WEG Eletric
http://www.weg.com.br

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


Re: Hook script doesn't work

Posted by Johan Appelgren <jo...@gmail.com>.
On 7/12/05, Célio Cidral Junior <cc...@gmail.com> wrote:
> Oh, I forgot it. Sorry :-P ... You can see it now.
> 
> 2005/7/12, Norbert Unterberg <nu...@gmail.com>:
> > 2005/7/12, Célio Cidral Junior <cc...@gmail.com>:
> >
> > > The
> > > hook script is attached (note that I removed the .bat extension
> > > because of anti-virus mail blocking).
> >
> > Hmm, where is the hook script? There is no script attached to your mail.
> >

Used your batch file and for me it works just fine. The only thing
missing is that the error message is echoed to stdout instead of
stderr. Only text on stderr is forwarded to the client.

Add >&2 like this to echo to stderr:
echo Property '%PROPNAME%' cannot be changed. >&2

/Johan

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


Re: Hook script doesn't work

Posted by Célio Cidral Junior <cc...@gmail.com>.
Oh, I forgot it. Sorry :-P ... You can see it now.

2005/7/12, Norbert Unterberg <nu...@gmail.com>:
> 2005/7/12, Célio Cidral Junior <cc...@gmail.com>:
> 
> > The
> > hook script is attached (note that I removed the .bat extension
> > because of anti-virus mail blocking).
> 
> Hmm, where is the hook script? There is no script attached to your mail.
> 
> Norbert
> 


-- 
Celio Cidral Junior
WEG Eletric
http://www.weg.com.br

Re: Hook script doesn't work

Posted by Norbert Unterberg <nu...@gmail.com>.
2005/7/12, Célio Cidral Junior <cc...@gmail.com>:

> The
> hook script is attached (note that I removed the .bat extension
> because of anti-virus mail blocking). 

Hmm, where is the hook script? There is no script attached to your mail.

Norbert

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