[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Problems with post-commit hook updating working copy

From: Ryan Schmidt <subversion-2007a_at_ryandesign.com>
Date: 2007-01-19 23:01:32 CET

On Jan 19, 2007, at 04:34, Alejandro Fernandez wrote:

> The goal of this hook is maintaining a working copy of the
> repository (which are php web application projects) published in
> the web server so the develoment group can test the applications
> publishing them through svn repository.
> I created a working copy with the a svn -co command.
> sudo -u apache svn co http://localhost/proyectosWeb/ html --
> username name --password pass
>
> The user apache is who's running the web-server service.
>
> I have tested two different ways for implementing the hook.
> A) A script which calls a C program:
> A.1) post-commit script:
>
> #!/bin/sh
> /repositorios/proyectosWeb/hooks/update-dev
>
> A.2) update-dev.c
>
> #include <stddef.h>
> #include <stdlib.h>
> #include <unistd.h>
>
> int main(void)
> {
> system("/usr/bin/svn update /var/www/html/ --
> non-interactive --username name--password pass");
> }
>
> B) A small C application called post-commit which send
> the update command directly:
> post-commit.c
>
> #include < stddef.h >
> #include <stdlib.h>
> #include <unistd.h>
> int main(void)
> {
> system("/usr/bin/svn update /var/www/html/ --non-
> interactive --username name --password pass");
> }
>
>
>
> All right, isnt't it?

I really couldn't say; I don't use C. Why do it in C? Why not a shell
script?

$ echo update-dev.sh
#!/bin/sh
/usr/bin/svn update /var/www/html --non-interactive --username u --
password p

> I give all the permisions to the /var/www/html/ path so I try to
> discard permissions problems.
> Then I run "Share project" from subclipse client (the eclipse
> plugin for svn) for a php project to upload a new project to the
> repository, and that way publish it in the web-server. And the
> problem is the working copy don't contain all the files we uploaded
> to the repository, some files and/or directories are missing.
>
> Curiously, when I run the post-commit script A, or the post-commit
> application B; DIRECTLY in the shell of the server it updates the
> working copy correctly, adding the files/directories that were
> missing.
> I run the post-commit with "sudo -u apache ./post-commit" to have
> the same rights.
> Also curiously, if I delete the project from repository and working
> copy and I re-"Share project" from eclipse THE SAME files/
> directories are missing again.
>
>
> Is this a permissions problem? Is this a bug? I've been a week to
> implement the hook, so my boss is going to kill me :-D.

Environment variables are different when the hook is called by
Subversion. In particular, the environment should be very close to
empty, and this may be a problem for some reason. See what kind of
error is occurring by writing stderr to a log, then reading the log:

$ echo update-dev.sh
#!/bin/sh
/usr/bin/svn update /var/www/html --non-interactive --username u --
password p 2>/tmp/update-dev.log

-- 
To reply to the mailing list, please use your mailer's Reply To All  
function
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Jan 19 23:02:07 2007

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.