Tim Bingham wrote:
>
> On Feb 9, 2007, at 4:25 PM, Doug Goldstein wrote:
>
>> Erik Hemdal wrote:
>>>> Erik Hemdal wrote:
>>>>>> Ryan Schmidt wrote:
>>>>>>> On Feb 9, 2007, at 12:25, Doug Goldstein wrote:
>>>>>>>
>>>> . . .
>>>>> Any possibility that another user, like 'svn' or 'apache' or
>>>>> 'whatever' is actually running the script and not the user you are
>>>>> testing with? Maybe setting world-execute would help?
>>>>>
>>>>> Erik
>>>>>
>>>>>
>>>>>
>>>> # ls -l /var/data/svn/project/hooks/pre-commit
>>>> -rwxr-xr-x 1 root svnusers 796 Feb 9 13:10
>>>> /var/data/svn/project/hooks/pre-commit
>>>>
>>> OK, the only other thing I can suggest is to verify you have execute
>>> permission on all the higher-level directories to the hook script.
>>> If you
>>> don't have it, you can't pass through to find the script so you can
>>> run it.
>>> Erik
>>
>> doug@doug ~ $ ssh doug@gravel
>> Last login: Fri Feb 9 16:22:19 2007 from doug.
>> doug@gravel ~ $ /var/data/svn/project/hooks/pre-commit
>> doug@gravel ~ $ echo $?
>> 0
>> doug@gravel ~ $ groups
>> users svnusers
>>
>> Since I am using svn+ssh://, my commits should be running as my user,
>> "doug". So svnserve will be running as that user.
>>
>> You can see the script is owned by the svnusers group, which I also am
>> a part of. If the directories below did not have the execute bit, I
>> would not be able to execute this file.
>
> I think you already know that -
> - the environment that the hook script runs in is empty (there's no
> PATH defined)
> - the hook script may not run as the user you expect
>
> I usually use brute force to debug hook scripts -
>
> - define a log file
> - for selected/every command 'cmd' in the hook script redirect all
> output to the log file
> - put messages in the log file with echo
>
> so the hook script might contain debugging code like this -
>
> LOG=/tmp/hook.log
>
> /usr/bin/whoami >> $LOG 2>&1
> /bin/echo "about to execute cmd" >> $LOG 2>&1
> cmd >> $LOG 2>&1
> /bin/echo "finished cmd" >> $LOG 2>&1
>
> Then on the server
>
> $ tail -f /tmp/hook.log
>
> Then on the client commit something
>
> When debugging I'm always surprised by what I see/don't see in the log
> file :-)
>
> Hope this helps.
>
> Tim.
>
>
>
>
# cat pre-commit
#!/bin/sh
LOG=/tmp/hook.log
/usr/bin/whoami >> $LOG 2>&1
/bin/echo "about to execute cmd" >> $LOG 2>&1
/bin/echo "finished cmd" >> $LOG 2>&1
Nothing was ever created in /tmp/. I can run the script successfully
with the following however:
env - /var/data/svn/monetra/hooks/pre-commit
The env - command clears out your environment so you don't even have
PATH set.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Feb 9 22:54:59 2007