You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "J. Bakshi" <jo...@infoservices.in> on 2009/06/02 12:46:09 UTC
strange reaction from post-commit hook
Hello list,
My greetings to all of you.
I hope I have joined the right list to discuss with post-commit
problem. I am running a clark-connect ( linux ) server ( kernel
2.6.18-8) with subversion
`````````````````````````````````````````
svn --version
svn, version 1.4.6 (r28521)
compiled Dec 31 2007, 15:01:44
``````````````````````````````````````
No problem to crete /add/commit repos through https
I have just decided to use the post-commit hook to automatically
update the sites running on this server when ever there is a commit. and
the problem has started. The apache server is running as apache:apache
(user:group) combination. the repos have the same permission level as
well as the folders under htdocs.
To start the experiment I have created a repo with just a file called
newfile
Here is my post-commit script with 755 permission
```````````````````````````
echo " svn post commit called "
/usr/bin/svn up /var/www/html/POSTCOMMIT
`````````````````````````````````````````
checkout, accepting the certificate permanently etc.... are the initial
stages I have to do. Now after modifying a file when I wanted to commit
; it reported back as
`````````````````````````````````````````````````
Sending newfile
svn: Commit failed (details follow):
svn: Your file or directory 'newfile' is probably out-of-date
svn: The version resource does not correspond to the resource within the
transaction. Either the requested version resource is out of date
(needs to be updated), or the requested version resource is newer than
the transaction root (restart the commit).
``````````````````````````````````````````````````````````
So I deleted the file and updated
```````````````````````````````````````````````````
rm newfile
rm: remove regular file `newfile'? y
[root@192 POSTCOMMIT]# svn up
Restored 'newfile'
U newfile
````````````````````````````````````````````````````
But the newfile get the root:root permission ( as I'm logged in as root)
. So I changed the ownership and permission as I did at the begging (
apache:apache and permisiion 777 )
After modifying the file when I tried to commit it failed :-(
`````````````````````````````
Sending newfile
Transmitting file data .
Committed revision 20.
Warning: 'post-commit' hook failed with error output:
svn: Working copy '/var/www/html/POSTCOMMIT' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
```````````````````````````````````
It repeated again and again even after " svn cleanup". I also tried
" chmod -R 777 .svn" once more but the same error.
If I manually execute the post-commit script; it runs perfectly well
with the echo which I placed inside the script. I am really confused and
no clue why the hook is not called properly. could any one kindly help
me to fix the problem ?
with many thanks
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2358767
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: [ SOLVED ] strange reaction from post-commit hook
Posted by "J. Bakshi" <jo...@infoservices.in>.
Ryan Schmidt wrote:
>
> On Jun 7, 2009, at 23:35, J. Bakshi wrote:
>
>> Ryan Schmidt wrote:
>>>
>>> On Jun 5, 2009, at 07:50, J. Bakshi wrote:
>>>
>>>> the script should be
>>>>
>>>> `````````````````````````````````````````
>>>> svn switch --relocate https://192.168.1.1/repos/test
>>>> file:///home/SVN/testi
>>>> svn up /var/www/html/POSTCOMMIT
>>>> ``````````````````````````````````````````````
>>>
>>> The relocate command only needs to be executed once, ever. It should
>>> not go in your hook script where it will be executed every time. Your
>>> hook script only needs an "svn up" as before.
>>
>> Thanks, I will place all the relocation as init.d script. So after
>> booting all relocation will be set.
>
> It doesn't need to be done every boot either. :) It only needs to be
> done once, ever. :) You've already run the command once now, so you
> can delete the command from anywhere it exists. The working copy has
> been relocated and will stay that way until you relocate it to
> somewhere else.
>
>
>
Oh ; Great !!!
Thanks a lot
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2360191
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: [ SOLVED ] strange reaction from post-commit hook
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 7, 2009, at 23:35, J. Bakshi wrote:
> Ryan Schmidt wrote:
>>
>> On Jun 5, 2009, at 07:50, J. Bakshi wrote:
>>
>>> the script should be
>>>
>>> `````````````````````````````````````````
>>> svn switch --relocate https://192.168.1.1/repos/test
>>> file:///home/SVN/testi
>>> svn up /var/www/html/POSTCOMMIT
>>> ``````````````````````````````````````````````
>>
>> The relocate command only needs to be executed once, ever. It should
>> not go in your hook script where it will be executed every time. Your
>> hook script only needs an "svn up" as before.
>
> Thanks, I will place all the relocation as init.d script. So after
> booting all relocation will be set.
It doesn't need to be done every boot either. :) It only needs to be
done once, ever. :) You've already run the command once now, so you
can delete the command from anywhere it exists. The working copy has
been relocated and will stay that way until you relocate it to
somewhere else.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2360182
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: [ SOLVED ] strange reaction from post-commit hook
Posted by "J. Bakshi" <jo...@infoservices.in>.
Ryan Schmidt wrote:
>
> On Jun 5, 2009, at 07:50, J. Bakshi wrote:
>
>> the script should be
>>
>> `````````````````````````````````````````
>> svn switch --relocate https://192.168.1.1/repos/test
>> file:///home/SVN/testi
>> svn up /var/www/html/POSTCOMMIT
>> ``````````````````````````````````````````````
>
> The relocate command only needs to be executed once, ever. It should
> not go in your hook script where it will be executed every time. Your
> hook script only needs an "svn up" as before.
>
>
>
Thanks, I will place all the relocation as init.d script. So after
booting all relocation will be set.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2360180
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: [ SOLVED ] strange reaction from post-commit hook
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 5, 2009, at 07:50, J. Bakshi wrote:
> the script should be
>
> `````````````````````````````````````````
> svn switch --relocate https://192.168.1.1/repos/test
> file:///home/SVN/testi
> svn up /var/www/html/POSTCOMMIT
> ``````````````````````````````````````````````
The relocate command only needs to be executed once, ever. It should
not go in your hook script where it will be executed every time. Your
hook script only needs an "svn up" as before.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359828
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: [ SOLVED ] strange reaction from post-commit hook
Posted by "J. Bakshi" <jo...@infoservices.in>.
J. Bakshi wrote:
> J. Bakshi wrote:
>
>> Ryan Schmidt wrote:
>>
>>
>>> On Jun 5, 2009, at 04:03, J. Bakshi wrote:
>>>
>>>
>>>
>>>> Based on your previous discussion I have just change /sbin/nologin to
>>>> /bin/bash of apache entry in /etc/password and assigned it a password.
>>>> then I login as apache user and did a "svn list" to accept the
>>>> certificate. After that the commit and hooks are working perfectly
>>>> Ok :-)
>>>> Thanks for your help. It really made me fixing the problem. I find it
>>>> little bit easier than the file:/// protocol you have mentioned above.
>>>> Specially the users on linux/wimdows client uses their GUI tool and
>>>> there it would not be possible to fire up the script as apache user.
>>>>
>>>>
>>> Your users don't need to do anything. All that you, in your role as
>>> server administrator, need to do, is relocate the POSTCOMMIT working
>>> copy to the file:// protocol, one single time. That's all. Your users
>>> will continue to use the https:// protocol.
>>>
>>> Giving your apache user a login shell is a security vulnerability and
>>> thus not recommended. Instead of this, if you insist on keeping the
>>> working copy checked out from http or https, you can use the
>>> --config-dir option to the "svn" command to tell it where to look for
>>> its config directory.
>>>
>>>
>> Hello Ryan,
>>
>> yes you are right that providing a shell access is actually a security
>> risk And I don't like to have that hole in my server. The first option
>> which you have suggested to use --relocate is very much attractive to me
>> as it only requires to modify the hook script only and transparent to
>> the users.
>>
>> I tried the file:// protocol like
>>
>> ````````````````````````````````````
>> svn switch --relocate \
>> https://192.168.1.1:443/repos/test \
>> file:///hoem/SVN/test \
>> /var/www/html/POSTCOMMIT
>> ````````````````````````````
>>
>> This update the repo successfully. But what to do to update the working
>> copy ?
>> I already tried to add
>>
>> ````````````````````
>> /usr/bin/svn up /var/www/html/POSTCOMMIT
>> `````````````````````````````````
>>
>> after the above code and it again asked for the certificate. I have
>> already disabled the login facility of apache.
>>
>>
>
> I have just discovered this error when running the command manually :-(
>
> svn switch --relocate https://192.168.1.1/repos/test
> file:///home/SVN/test /var/www/html/POSTCOMMIT
>
> svn: Relocate can only change the repository part of an URL
>
Ryan great news.
Now everything is working fine ( and apache has no login shell :-) )
the script should be
`````````````````````````````````````````
svn switch --relocate https://192.168.1.1/repos/test
file:///home/SVN/testi
svn up /var/www/html/POSTCOMMIT
``````````````````````````````````````````````
Millions and millions of thanks to you for your kind guidance.
>
>>
>>
>>>
>>>
>>>> Though there is some permission problem if I use samba. In post-commit
>>>> if I use a samba mount point like
>>>>
>>>>
>>> I have also seen issues when trying to use svn commands on an smb
>>> mount point. I cannot help you resolve them.
>>>
>>>
>> Never Mind. You have already helped me ALOT.........
>> millions of thanks
>>
>>
>>
>>>
>>>
>> ------------------------------------------------------
>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359649
>>
>> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>>
>>
>>
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359694
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359696
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: strange reaction from post-commit hook
Posted by "J. Bakshi" <jo...@infoservices.in>.
J. Bakshi wrote:
> Ryan Schmidt wrote:
>
>> On Jun 5, 2009, at 04:03, J. Bakshi wrote:
>>
>>
>>> Based on your previous discussion I have just change /sbin/nologin to
>>> /bin/bash of apache entry in /etc/password and assigned it a password.
>>> then I login as apache user and did a "svn list" to accept the
>>> certificate. After that the commit and hooks are working perfectly
>>> Ok :-)
>>> Thanks for your help. It really made me fixing the problem. I find it
>>> little bit easier than the file:/// protocol you have mentioned above.
>>> Specially the users on linux/wimdows client uses their GUI tool and
>>> there it would not be possible to fire up the script as apache user.
>>>
>> Your users don't need to do anything. All that you, in your role as
>> server administrator, need to do, is relocate the POSTCOMMIT working
>> copy to the file:// protocol, one single time. That's all. Your users
>> will continue to use the https:// protocol.
>>
>> Giving your apache user a login shell is a security vulnerability and
>> thus not recommended. Instead of this, if you insist on keeping the
>> working copy checked out from http or https, you can use the
>> --config-dir option to the "svn" command to tell it where to look for
>> its config directory.
>>
>
> Hello Ryan,
>
> yes you are right that providing a shell access is actually a security
> risk And I don't like to have that hole in my server. The first option
> which you have suggested to use --relocate is very much attractive to me
> as it only requires to modify the hook script only and transparent to
> the users.
>
> I tried the file:// protocol like
>
> ````````````````````````````````````
> svn switch --relocate \
> https://192.168.1.1:443/repos/test \
> file:///hoem/SVN/test \
> /var/www/html/POSTCOMMIT
> ````````````````````````````
>
> This update the repo successfully. But what to do to update the working
> copy ?
> I already tried to add
>
> ````````````````````
> /usr/bin/svn up /var/www/html/POSTCOMMIT
> `````````````````````````````````
>
> after the above code and it again asked for the certificate. I have
> already disabled the login facility of apache.
>
I have just discovered this error when running the command manually :-(
svn switch --relocate https://192.168.1.1/repos/test
file:///home/SVN/test /var/www/html/POSTCOMMIT
svn: Relocate can only change the repository part of an URL
>
>>
>>> Though there is some permission problem if I use samba. In post-commit
>>> if I use a samba mount point like
>>>
>> I have also seen issues when trying to use svn commands on an smb
>> mount point. I cannot help you resolve them.
>>
>
> Never Mind. You have already helped me ALOT.........
> millions of thanks
>
>
>>
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359649
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359694
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: strange reaction from post-commit hook
Posted by "J. Bakshi" <jo...@infoservices.in>.
Ryan Schmidt wrote:
>
> On Jun 5, 2009, at 04:03, J. Bakshi wrote:
>
>> Based on your previous discussion I have just change /sbin/nologin to
>> /bin/bash of apache entry in /etc/password and assigned it a password.
>> then I login as apache user and did a "svn list" to accept the
>> certificate. After that the commit and hooks are working perfectly
>> Ok :-)
>> Thanks for your help. It really made me fixing the problem. I find it
>> little bit easier than the file:/// protocol you have mentioned above.
>> Specially the users on linux/wimdows client uses their GUI tool and
>> there it would not be possible to fire up the script as apache user.
>
> Your users don't need to do anything. All that you, in your role as
> server administrator, need to do, is relocate the POSTCOMMIT working
> copy to the file:// protocol, one single time. That's all. Your users
> will continue to use the https:// protocol.
>
> Giving your apache user a login shell is a security vulnerability and
> thus not recommended. Instead of this, if you insist on keeping the
> working copy checked out from http or https, you can use the
> --config-dir option to the "svn" command to tell it where to look for
> its config directory.
Hello Ryan,
yes you are right that providing a shell access is actually a security
risk And I don't like to have that hole in my server. The first option
which you have suggested to use --relocate is very much attractive to me
as it only requires to modify the hook script only and transparent to
the users.
I tried the file:// protocol like
````````````````````````````````````
svn switch --relocate \
https://192.168.1.1:443/repos/test \
file:///hoem/SVN/test \
/var/www/html/POSTCOMMIT
````````````````````````````
This update the repo successfully. But what to do to update the working
copy ?
I already tried to add
````````````````````
/usr/bin/svn up /var/www/html/POSTCOMMIT
`````````````````````````````````
after the above code and it again asked for the certificate. I have
already disabled the login facility of apache.
>
>
>> Though there is some permission problem if I use samba. In post-commit
>> if I use a samba mount point like
>
> I have also seen issues when trying to use svn commands on an smb
> mount point. I cannot help you resolve them.
Never Mind. You have already helped me ALOT.........
millions of thanks
>
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359649
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: strange reaction from post-commit hook
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 5, 2009, at 04:03, J. Bakshi wrote:
> Based on your previous discussion I have just change /sbin/
> nologin to
> /bin/bash of apache entry in /etc/password and assigned it a password.
> then I login as apache user and did a "svn list" to accept the
> certificate. After that the commit and hooks are working perfectly
> Ok :-)
> Thanks for your help. It really made me fixing the problem. I find it
> little bit easier than the file:/// protocol you have mentioned above.
> Specially the users on linux/wimdows client uses their GUI tool and
> there it would not be possible to fire up the script as apache user.
Your users don't need to do anything. All that you, in your role as
server administrator, need to do, is relocate the POSTCOMMIT working
copy to the file:// protocol, one single time. That's all. Your users
will continue to use the https:// protocol.
Giving your apache user a login shell is a security vulnerability and
thus not recommended. Instead of this, if you insist on keeping the
working copy checked out from http or https, you can use the --config-
dir option to the "svn" command to tell it where to look for its
config directory.
> Though there is some permission problem if I use samba. In post-commit
> if I use a samba mount point like
I have also seen issues when trying to use svn commands on an smb
mount point. I cannot help you resolve them.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359641
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: strange reaction from post-commit hook
Posted by "J. Bakshi" <jo...@infoservices.in>.
Ryan Schmidt wrote:
> On Jun 5, 2009, at 00:21, J. Bakshi wrote:
>
>
>> Thanks for your kind guidance. This time I have created a new
>> folder and
>> chekout the repo within that folder . Then I did some modification in
>> the "newfile" and tried to commit. As you expected there is no such
>> errors as before. The repo has been updated BUT post-commit failed
>> with
>>
>> ``````````````````````````````````````````````````````````````````````
>> ````
>> Sending newfile
>> Transmitting file data .
>> Committed revision 36.
>>
>> Warning: 'post-commit' hook failed with error output:
>> Error validating server certificate for 'https://192.168.1.1:443':
>> - The certificate is not issued by a trusted authority. Use the
>> fingerprint to validate the certificate manually!
>> - The certificate hostname does not match.
>> Certificate information:
>> - Hostname: gateway.clarkconnect.lan
>> - Valid: from Jul 8 05:19:27 2008 GMT until Jul 6 05:19:27 2018 GMT
>> - Issuer: Typo3, Kolkata Infoservices Pvt Ltd, Kolkata, West
>> Bengal, IN
>> - Fingerprint: 10:ea:91:68:4e:46:c8:71:5b:d6:98:db:38:2a:cb:
>> 12:b2:bd:61:15
>> (R)eject, accept (t)emporarily or accept (p)ermanently? svn: PROPFIND
>> request failed on '/repos/test'
>> svn: PROPFIND of '/repos/test': Server certificate verification
>> failed:
>> certificate issued for a different hostname, issuer is not trusted
>> (https://192.168.1.1)
>>
>> ``````````````````````````````````````````````````````````````````````
>> ````````````
>>
>> Surprisingly svn list https://192.168.1.1/repos/test with out
>> any
>> hitch.
>>
>
> Your user, the one you're running "svn list" as, has already accepted
> the certificate, but the user the hook is running as (the apache
> user) has not done this. The apache user probably doesn't even have a
> home directory, thus no .subversion directory inside it and no place
> to store information about accepted certificates.
>
> There's really no need for the hook's working copy to be checked out
> from https, or even http. Just check out from the repository directly
> using the file:/// protocol. It'll be faster since you can bypass
> apache completely. You can check out a new working copy and replace
> the one currently in POSTCOMMIT, or relocate the one in POSTCOMMIT
> using "svn switch --relocate".
>
Ryan, it is really a great info. If you did not explain it I might be
still continue with it blindly with the tutorial available in net.
Millions of thanks.
I don't know how file:/// protocol is working but do you think It is
valid here. apache and svn is there in my development server and
checkout/commit is done from physically separate Linux/Windows box. So
the commit should modify the sites in the development server through
post-commit hook.
Really some more kind guidance from you.
Once again millions of thanks to make me understand the technology.
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359601
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359603
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: strange reaction from post-commit hook
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 5, 2009, at 00:21, J. Bakshi wrote:
> Thanks for your kind guidance. This time I have created a new
> folder and
> chekout the repo within that folder . Then I did some modification in
> the "newfile" and tried to commit. As you expected there is no such
> errors as before. The repo has been updated BUT post-commit failed
> with
>
> ``````````````````````````````````````````````````````````````````````
> ````
> Sending newfile
> Transmitting file data .
> Committed revision 36.
>
> Warning: 'post-commit' hook failed with error output:
> Error validating server certificate for 'https://192.168.1.1:443':
> - The certificate is not issued by a trusted authority. Use the
> fingerprint to validate the certificate manually!
> - The certificate hostname does not match.
> Certificate information:
> - Hostname: gateway.clarkconnect.lan
> - Valid: from Jul 8 05:19:27 2008 GMT until Jul 6 05:19:27 2018 GMT
> - Issuer: Typo3, Kolkata Infoservices Pvt Ltd, Kolkata, West
> Bengal, IN
> - Fingerprint: 10:ea:91:68:4e:46:c8:71:5b:d6:98:db:38:2a:cb:
> 12:b2:bd:61:15
> (R)eject, accept (t)emporarily or accept (p)ermanently? svn: PROPFIND
> request failed on '/repos/test'
> svn: PROPFIND of '/repos/test': Server certificate verification
> failed:
> certificate issued for a different hostname, issuer is not trusted
> (https://192.168.1.1)
>
> ``````````````````````````````````````````````````````````````````````
> ````````````
>
> Surprisingly svn list https://192.168.1.1/repos/test with out
> any
> hitch.
Your user, the one you're running "svn list" as, has already accepted
the certificate, but the user the hook is running as (the apache
user) has not done this. The apache user probably doesn't even have a
home directory, thus no .subversion directory inside it and no place
to store information about accepted certificates.
There's really no need for the hook's working copy to be checked out
from https, or even http. Just check out from the repository directly
using the file:/// protocol. It'll be faster since you can bypass
apache completely. You can check out a new working copy and replace
the one currently in POSTCOMMIT, or relocate the one in POSTCOMMIT
using "svn switch --relocate".
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359601
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: strange reaction from post-commit hook
Posted by "J. Bakshi" <jo...@infoservices.in>.
Ryan Schmidt wrote:
> On Jun 4, 2009, at 01:08, J. Bakshi wrote:
>
>
>>>> It repeated again and again even after " svn cleanup". I also
>>>> tried " chmod -R 777 .svn" once more but the same error.
>>>>
>>> Please confirm: even after running "svn cleanup", running "svn
>>> update" tells you the working copy is locked? Is this only when
>>> running "svn update" from the hook script or also when running "svn
>>> update" from the command line?
>>>
>> "svn up" from command line is working well
>>
>> `````````````````````````````````````````````````
>> [root@192 POSTCOMMIT]# vim newfile
>> [root@192 POSTCOMMIT]# svn commit -m "check 24" newfile
>> Sending newfile
>> Transmitting file data .
>> Committed revision 24.
>>
>> Warning: 'post-commit' hook failed with error output:
>> svn: Working copy '/var/www/html/POSTCOMMIT' locked
>> svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for
>> details)
>>
>> [root@192 POSTCOMMIT]# svn cleanup
>> [root@192 POSTCOMMIT]# svn up newfile
>> At revision 24.
>>
>
> Wait. You are committing from within the POSTCOMMIT directory! So of
> course the working copy will be locked -- a commit is currently in
> progress in it.
>
> You should not be committing from the POSTCOMMIT directory. That
> working copy should only be manipulated by the post-commit hook, and
> not by you.
>
> Get a different working copy, somewhere else, and commit in it. Your
> post-commit hook should be working fine.
>
Hello Ryan,
Thanks for your kind guidance. This time I have created a new folder and
chekout the repo within that folder . Then I did some modification in
the "newfile" and tried to commit. As you expected there is no such
errors as before. The repo has been updated BUT post-commit failed with
``````````````````````````````````````````````````````````````````````````
Sending newfile
Transmitting file data .
Committed revision 36.
Warning: 'post-commit' hook failed with error output:
Error validating server certificate for 'https://192.168.1.1:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
- The certificate hostname does not match.
Certificate information:
- Hostname: gateway.clarkconnect.lan
- Valid: from Jul 8 05:19:27 2008 GMT until Jul 6 05:19:27 2018 GMT
- Issuer: Typo3, Kolkata Infoservices Pvt Ltd, Kolkata, West Bengal, IN
- Fingerprint: 10:ea:91:68:4e:46:c8:71:5b:d6:98:db:38:2a:cb:12:b2:bd:61:15
(R)eject, accept (t)emporarily or accept (p)ermanently? svn: PROPFIND
request failed on '/repos/test'
svn: PROPFIND of '/repos/test': Server certificate verification failed:
certificate issued for a different hostname, issuer is not trusted
(https://192.168.1.1)
``````````````````````````````````````````````````````````````````````````````````
Surprisingly svn list https://192.168.1.1/repos/test with out any
hitch.
Also the manual test as you suggested is working well
`````````````````````````````````````````````
env -i ./post-commit /var/www/html/POSTCOMMIT/ 36
svn post commit called
U /var/www/html/POSTCOMMIT/newfile
```````````````````````````````````````````````
What might be then the problem with updating via https ? svn list is
working well but not the hook !!!
Here is again my post-commit script
``````````````````````````````````````````````````
#! /bin/bash
#REPOS="$1"
#REV="$2"
echo " svn post commit called "
/usr/bin/svn up /var/www/html/POSTCOMMIT || exit $?
````````````````````````````````````````````````````````
Please suggest any mistake which I might still overlooking ???
>
>
>>> Note also that hook scripts run in an empty environment. When you
>>> manually execute the hook script, it inherits the environment (PATH,
>>> etc.) from your shell and is thus not necessarily a good test. You
>>> can get closer by running the hook script through the env command to
>>> clear the environment:
>>>
>>> env -i ./post-commit /path/to/repo $REV
>>>
>> Ok, I have done it
>>
>> ````````````````````````````
>> env -i ./post-commit https://192.168.1.1:/repos/test
>> svn post commit called
>> At revision 24.
>> ~~~~~~~~~~~~~~~~~
>>
>
> It's not really relevant here, since your post-commit hook doesn't
> use any of the parameters given to it, but note that the first
> parameter to the post-commit script is the path to the repository on
> disk, not its URL; and the second parameter is the revision that was
> just committed.
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359544
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359599
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: strange reaction from post-commit hook
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 4, 2009, at 01:08, J. Bakshi wrote:
>>> It repeated again and again even after " svn cleanup". I also
>>> tried " chmod -R 777 .svn" once more but the same error.
>>
>> Please confirm: even after running "svn cleanup", running "svn
>> update" tells you the working copy is locked? Is this only when
>> running "svn update" from the hook script or also when running "svn
>> update" from the command line?
>
> "svn up" from command line is working well
>
> `````````````````````````````````````````````````
> [root@192 POSTCOMMIT]# vim newfile
> [root@192 POSTCOMMIT]# svn commit -m "check 24" newfile
> Sending newfile
> Transmitting file data .
> Committed revision 24.
>
> Warning: 'post-commit' hook failed with error output:
> svn: Working copy '/var/www/html/POSTCOMMIT' locked
> svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for
> details)
>
> [root@192 POSTCOMMIT]# svn cleanup
> [root@192 POSTCOMMIT]# svn up newfile
> At revision 24.
Wait. You are committing from within the POSTCOMMIT directory! So of
course the working copy will be locked -- a commit is currently in
progress in it.
You should not be committing from the POSTCOMMIT directory. That
working copy should only be manipulated by the post-commit hook, and
not by you.
Get a different working copy, somewhere else, and commit in it. Your
post-commit hook should be working fine.
>> Note also that hook scripts run in an empty environment. When you
>> manually execute the hook script, it inherits the environment (PATH,
>> etc.) from your shell and is thus not necessarily a good test. You
>> can get closer by running the hook script through the env command to
>> clear the environment:
>>
>> env -i ./post-commit /path/to/repo $REV
>
> Ok, I have done it
>
> ````````````````````````````
> env -i ./post-commit https://192.168.1.1:/repos/test
> svn post commit called
> At revision 24.
> ~~~~~~~~~~~~~~~~~
It's not really relevant here, since your post-commit hook doesn't
use any of the parameters given to it, but note that the first
parameter to the post-commit script is the path to the repository on
disk, not its URL; and the second parameter is the revision that was
just committed.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359544
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: strange reaction from post-commit hook
Posted by "J. Bakshi" <jo...@infoservices.in>.
Ryan Schmidt wrote:
> On Jun 2, 2009, at 07:46, J. Bakshi wrote:
>
>
>> I hope I have joined the right list to discuss with post-commit
>> problem.
>>
>
> Yes, this is a great place to discuss hook scripts.
>
Hello Ryan,
Thanks for your kind attention.
>
>> I am running a clark-connect ( linux ) server ( kernel
>> 2.6.18-8) with subversion
>>
>> `````````````````````````````````````````
>> svn --version
>> svn, version 1.4.6 (r28521)
>> compiled Dec 31 2007, 15:01:44
>> ``````````````````````````````````````
>>
>
> You may want to consider upgrading to a more recent version of
> Subversion. The current version is 1.6.2.
>
>
I want to do it but as it is a clark connect server, there is still no
latest rpm available and as it is a development server I have made
myself slower to upgrade it manually from individual .rpm. I like to
solve the present hook problem first and then I'll go for up-gradation
by collecting .rpm from net.
>> I have just decided to use the post-commit hook to automatically
>> update the sites running on this server when ever there is a
>> commit. and
>> the problem has started. The apache server is running as
>> apache:apache
>> (user:group) combination. the repos have the same permission level as
>> well as the folders under htdocs.
>>
>> To start the experiment I have created a repo with just a file called
>> newfile
>>
>> Here is my post-commit script with 755 permission
>>
>> ```````````````````````````
>> echo " svn post commit called "
>> /usr/bin/svn up /var/www/html/POSTCOMMIT
>> `````````````````````````````````````````
>>
>
> Maybe you just didn't show it to us, but the first line of a hook
> script must be a line beginning with "#!" followed by the path to the
> interpreter that should be used to run the script. For example "#!/
> bin/bash".
>
yes it is already there.
```````````````````````````````````
#! /bin/sh
``````````````````````````````````
> I assume /var/www/html/POSTCOMMIT already exists, is a checkout of
> your repository, and every file and directory in it is owned by
> apache:apache?
>
>
yes, true. I actually created the /var/www/html/POSTCOMMIT and then
did a checkout inside it. after that I made the directory as apache:apache
>> checkout, accepting the certificate permanently etc.... are the
>> initial
>> stages I have to do. Now after modifying a file when I wanted to
>> commit
>> ; it reported back as
>>
>> `````````````````````````````````````````````````
>> Sending newfile
>> svn: Commit failed (details follow):
>> svn: Your file or directory 'newfile' is probably out-of-date
>> svn: The version resource does not correspond to the resource
>> within the
>> transaction. Either the requested version resource is out of date
>> (needs to be updated), or the requested version resource is newer than
>> the transaction root (restart the commit).
>> ``````````````````````````````````````````````````````````
>>
>
> Doesn't sound related to the hook script. It just sounds like your
> file was out of date, a perfectly normal situation to have occur.
> "svn update" should resolve it.
>
>
>> So I deleted the file and updated
>>
>> ```````````````````````````````````````````````````
>> rm newfile
>> rm: remove regular file `newfile'? y
>>
>> [root@192 POSTCOMMIT]# svn up
>> Restored 'newfile'
>> U newfile
>> ````````````````````````````````````````````````````
>>
>
> Removing newfile shouldn't have been necessary, but is fine if your
> intention was to discard the changes you had made to newfile.
>
>
>> But the newfile get the root:root permission ( as I'm logged in as
>> root)
>>
>
> That sounds totally normal.
>
>
>> . So I changed the ownership and permission as I did at the begging (
>> apache:apache and permisiion 777 )
>>
>> After modifying the file when I tried to commit it failed :-(
>>
>> `````````````````````````````
>> Sending newfile
>> Transmitting file data .
>> Committed revision 20.
>>
>> Warning: 'post-commit' hook failed with error output:
>> svn: Working copy '/var/www/html/POSTCOMMIT' locked
>> svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for
>> details)
>>
>> ```````````````````````````````````
>>
>
> It sounds like the working copy was locked, either because an svn
> command was still running on that working copy, or because one had
> been running and exited or was killed unexpectedly. If the former,
> wait for it to finish; if the latter, "svn cleanup" should resolve it.
>
>
>> It repeated again and again even after " svn cleanup". I also
>> tried
>> " chmod -R 777 .svn" once more but the same error.
>>
>
> Please confirm: even after running "svn cleanup", running "svn
> update" tells you the working copy is locked? Is this only when
> running "svn update" from the hook script or also when running "svn
> update" from the command line?
>
>
"svn up" from command line is working well
`````````````````````````````````````````````````
[root@192 POSTCOMMIT]# vim newfile
[root@192 POSTCOMMIT]# svn commit -m "check 24" newfile
Sending newfile
Transmitting file data .
Committed revision 24.
Warning: 'post-commit' hook failed with error output:
svn: Working copy '/var/www/html/POSTCOMMIT' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
[root@192 POSTCOMMIT]# svn cleanup
[root@192 POSTCOMMIT]# svn up newfile
At revision 24.
`````````````````````````````````````````````````````````
>> If I manually execute the post-commit script; it runs perfectly well
>> with the echo which I placed inside the script. I am really
>> confused and
>> no clue why the hook is not called properly. could any one kindly
>> help
>> me to fix the problem ?
>>
>
> You're welcome to keep the echo in there, but note that that message
> will never appear to the client when Subversion runs the script as a
> hook script. Hook scripts only display to the client the output that
> was printed to stderr, not the output that was printed to stdout like
> your echo, and they only do this if the hook script exits with a non-
> zero code.
>
> Note also that hook scripts run in an empty environment. When you
> manually execute the hook script, it inherits the environment (PATH,
> etc.) from your shell and is thus not necessarily a good test. You
> can get closer by running the hook script through the env command to
> clear the environment:
>
> env -i ./post-commit /path/to/repo $REV
>
Ok, I have done it
````````````````````````````
env -i ./post-commit https://192.168.1.1:/repos/test
svn post commit called
At revision 24.
~~~~~~~~~~~~~~~~~~~~~~~
> Note also that when you run the hook manually, it is running as your
> user, and in particular, a Subversion command running in the hook
> script is looking in your user's .subversion directory for settings,
> authentication caches, and so forth. When run as a hook script, it's
> running, in your case, as the apache user, so it's looking for
> a .subversion directory belonging to the apache user. One may not
> exist. If your apache user doesn't have a login shell (it usually
> doesn't) it may not even be possible for one to exist. You may need
> to tell the svn command to look at a specific config directory using
> the --config-dir option.
>
> Finally, you will want to know if an error occurs while running the
> svn up command. To facilitate this, I suggest you modify your "svn
> up" line as follows:
>
> /usr/bin/svn up /var/www/html/POSTCOMMIT || exit $?
>
>
Ok, I have updated the post-commit script with " || exit $? "
and now the commit reports the same error :-(
```````````````````````````````````````````````
svn commit -m "25" newfile
Sending newfile
Transmitting file data .
Committed revision 27.
Warning: 'post-commit' hook failed with error output:
svn: Working copy '/var/www/html/POSTCOMMIT' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
```````````````````````````````````````````````````````````````
I also tried from a different machine ( first checkout and then modify a
file and then tried to commit ). And see the horrible error
```````````````````````````````````````````````````````````
svn commit -m "test" newfile
Sending newfile
Transmitting file data .
Committed revision 31.
Warning: 'post-commit' hook failed with error output:
Error validating server certificate for 'https://192.168.1.1:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
- The certificate hostname does not match.
Certificate information:
- Hostname: gateway.clarkconnect.lan
- Valid: from Jul 8 05:19:27 2008 GMT until Jul 6 05:19:27 2018 GMT
- Issuer: Typo3, Kolkata Infoservices Pvt Ltd, Kolkata, West Bengal, IN
- Fingerprint: 10:ea:91:68:4e:46:c8:71:5b:d6:98:db:38:2a:cb:12:b2:bd:61:15
(R)eject, accept (t)emporarily or accept (p)ermanently? svn: PROPFIND
request failed on '/repos/test'
svn: PROPFIND of '/repos/test': Server certificate verification failed:
certificate issued for a different hostname, issuer is not trusted
(https://192.168.1.1)
````````````````````````````````````````````````````````````````````
But surprisingly it has no problem to list the repo
````````````````````````````````````````
svn list https://192.168.1.1/repos/test
newfile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I am very much confused now :-(
> This way, if "svn up" fails, the hook script will exit with the exit
> code of svn, and since svn will have printed something to stderr, you
> will see this message on the client.
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2358922
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359292
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: strange reaction from post-commit hook
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 2, 2009, at 07:46, J. Bakshi wrote:
> I hope I have joined the right list to discuss with post-commit
> problem.
Yes, this is a great place to discuss hook scripts.
> I am running a clark-connect ( linux ) server ( kernel
> 2.6.18-8) with subversion
>
> `````````````````````````````````````````
> svn --version
> svn, version 1.4.6 (r28521)
> compiled Dec 31 2007, 15:01:44
> ``````````````````````````````````````
You may want to consider upgrading to a more recent version of
Subversion. The current version is 1.6.2.
> I have just decided to use the post-commit hook to automatically
> update the sites running on this server when ever there is a
> commit. and
> the problem has started. The apache server is running as
> apache:apache
> (user:group) combination. the repos have the same permission level as
> well as the folders under htdocs.
>
> To start the experiment I have created a repo with just a file called
> newfile
>
> Here is my post-commit script with 755 permission
>
> ```````````````````````````
> echo " svn post commit called "
> /usr/bin/svn up /var/www/html/POSTCOMMIT
> `````````````````````````````````````````
Maybe you just didn't show it to us, but the first line of a hook
script must be a line beginning with "#!" followed by the path to the
interpreter that should be used to run the script. For example "#!/
bin/bash".
I assume /var/www/html/POSTCOMMIT already exists, is a checkout of
your repository, and every file and directory in it is owned by
apache:apache?
> checkout, accepting the certificate permanently etc.... are the
> initial
> stages I have to do. Now after modifying a file when I wanted to
> commit
> ; it reported back as
>
> `````````````````````````````````````````````````
> Sending newfile
> svn: Commit failed (details follow):
> svn: Your file or directory 'newfile' is probably out-of-date
> svn: The version resource does not correspond to the resource
> within the
> transaction. Either the requested version resource is out of date
> (needs to be updated), or the requested version resource is newer than
> the transaction root (restart the commit).
> ``````````````````````````````````````````````````````````
Doesn't sound related to the hook script. It just sounds like your
file was out of date, a perfectly normal situation to have occur.
"svn update" should resolve it.
> So I deleted the file and updated
>
> ```````````````````````````````````````````````````
> rm newfile
> rm: remove regular file `newfile'? y
>
> [root@192 POSTCOMMIT]# svn up
> Restored 'newfile'
> U newfile
> ````````````````````````````````````````````````````
Removing newfile shouldn't have been necessary, but is fine if your
intention was to discard the changes you had made to newfile.
> But the newfile get the root:root permission ( as I'm logged in as
> root)
That sounds totally normal.
> . So I changed the ownership and permission as I did at the begging (
> apache:apache and permisiion 777 )
>
> After modifying the file when I tried to commit it failed :-(
>
> `````````````````````````````
> Sending newfile
> Transmitting file data .
> Committed revision 20.
>
> Warning: 'post-commit' hook failed with error output:
> svn: Working copy '/var/www/html/POSTCOMMIT' locked
> svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for
> details)
>
> ```````````````````````````````````
It sounds like the working copy was locked, either because an svn
command was still running on that working copy, or because one had
been running and exited or was killed unexpectedly. If the former,
wait for it to finish; if the latter, "svn cleanup" should resolve it.
> It repeated again and again even after " svn cleanup". I also
> tried
> " chmod -R 777 .svn" once more but the same error.
Please confirm: even after running "svn cleanup", running "svn
update" tells you the working copy is locked? Is this only when
running "svn update" from the hook script or also when running "svn
update" from the command line?
> If I manually execute the post-commit script; it runs perfectly well
> with the echo which I placed inside the script. I am really
> confused and
> no clue why the hook is not called properly. could any one kindly
> help
> me to fix the problem ?
You're welcome to keep the echo in there, but note that that message
will never appear to the client when Subversion runs the script as a
hook script. Hook scripts only display to the client the output that
was printed to stderr, not the output that was printed to stdout like
your echo, and they only do this if the hook script exits with a non-
zero code.
Note also that hook scripts run in an empty environment. When you
manually execute the hook script, it inherits the environment (PATH,
etc.) from your shell and is thus not necessarily a good test. You
can get closer by running the hook script through the env command to
clear the environment:
env -i ./post-commit /path/to/repo $REV
Note also that when you run the hook manually, it is running as your
user, and in particular, a Subversion command running in the hook
script is looking in your user's .subversion directory for settings,
authentication caches, and so forth. When run as a hook script, it's
running, in your case, as the apache user, so it's looking for
a .subversion directory belonging to the apache user. One may not
exist. If your apache user doesn't have a login shell (it usually
doesn't) it may not even be possible for one to exist. You may need
to tell the svn command to look at a specific config directory using
the --config-dir option.
Finally, you will want to know if an error occurs while running the
svn up command. To facilitate this, I suggest you modify your "svn
up" line as follows:
/usr/bin/svn up /var/www/html/POSTCOMMIT || exit $?
This way, if "svn up" fails, the hook script will exit with the exit
code of svn, and since svn will have printed something to stderr, you
will see this message on the client.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2358922
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].