Subversion post-commit hooks, Error Merge of blah : 200 OK
The simple idea of
#!/bin/sh
svn up /var/www
Didn't work and various others neither. Now I'm running a small C program instead, also running fine from command line but not after I try to commit something.
I'm using Tortoise SVN and I'm getting :
Error : Commit Failed (details follow ) :
Error: MERGE of '/svn/web/test': 200 OK (
While when I run an 'svn up' manually after, it just shows as committed as a new rev.
I've searched around on Google as well, but nothing seemed to solve the problem.. any idea what else I could try?
I only need 'svn up /var/www' to be ran after I commit something to my repo in /opt/svn/web/ Doesn't matter much in what way..
Thanks in advance
15 Replies
Looks like it could be a permissions issue.
Then did post-commit like this :
#!/bin/sh
webupdater
env - ./post-commit /opt/svn/web/
Gives the same output.
Then I tried adding a test file, did svn commit and same error again in TortoiseSVN. Tried locally this and received another error :
svn commit -m test
Sending test.txt
Transmitting file data .
Committed revision 105.
Warning: 'post-commit' hook failed with error output:
svn: Working copy '/var/www' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
After I do svn cleanup and commit again, same error over and over.. something I'm missing or?
Thanks btw, didn't expect the subversion faq to have a piece about versioning websites
Having said that, according to that SVN FAW, the post-commit is being run by the user that runs your apache/svnserve process. How do you access your repository? You mention TortoiseSVN, but what is the protocol? It's usually svn, http or svn+ssh.
I'm accessing it via https.
Clients : TortoiseSVN on my Windows box, just command line subversion client on the linode and the same on my Linux box.
And yeah, I made all the .svn folders accessible to all users.
And the chmod +s on the little updater program makes it run as root or something, I read somewhere.
su to the user that usually runs the apache process. It's www-data on debian/ubuntu (?).
Execute the "env - ./post-commit /opt/svn/web/" command
What hapens then?
@Navi:
And the chmod +s on the little updater program makes it run as root or something, I read somewhere.
This isn't entirely accurate. That make the executable setuid. It will run with the permissions of the user that owns it. If root owns it then it will run as root, but if it's owned by someone else then it runs as that user.
@GrunkaLunka:
@Navi:And the chmod +s on the little updater program makes it run as root or something, I read somewhere.
This isn't entirely accurate. That make the executable setuid. It will run with the permissions of the user that owns it. If root owns it then it will run as root, but if it's owned by someone else then it runs as that user.
To be entirely accurate, it runs with the effective userid of the user that owns the file. This is subtly different and normally means the same thing. But it's not quite the same.
See "man geteuid".
Yes, I am being pedantic, but… well, you did say "entirely accurate"
@sweh:
it runs with the effective userid of the user that owns the file
Very true. Thanks for the correction sir.
This account is currently not available.
I'm running Fedora 10 btw
And ah kay, I see. Thanks
root 17126 0.1 4.9 88572 18136 ? Ss 04:12 0:00 /usr/sbin/httpd
apache 17128 0.0 1.8 88572 6860 ? S 04:12 0:00 /usr/sbin/httpd
apache 17129 0.0 1.8 88704 6956 ? S 04:12 0:00 /usr/sbin/httpd
apache 17130 0.0 2.9 89900 10788 ? S 04:12 0:00 /usr/sbin/httpd
apache 17131 0.0 2.0 88704 7568 ? S 04:12 0:00 /usr/sbin/httpd
apache 17132 0.0 2.4 89628 8908 ? S 04:12 0:00 /usr/sbin/httpd
apache 17133 0.0 1.8 88572 6864 ? S 04:12 0:00 /usr/sbin/httpd
apache 17134 0.0 1.6 88572 6016 ? S 04:12 0:00 /usr/sbin/httpd
apache 17135 0.0 1.6 88572 6012 ? S 04:12 0:00 /usr/sbin/httpd
root 17152 0.0 0.1 4124 700 pts/0 S+ 04:15 0:00 grep http
````
What's the output of
su apache -c 'env - ./post-commit /opt/svn/web/'
I got it completely working now =D
I've chown apache.apache on /var/www to ensure I've had permissions. I've changed the shell of apache to enable me to run that command. I've changed permissions on /opt/svn/web to 777. Ran 'su apache -c 'webupdater' and it worked, then tried via an commit and it worked as well.
It's an awesome sight, again thanks alot for pointing me in the right direction!
Which permissions would you recommend on '/var/www' and '/opt/svn/web' ?