hook permissions, visualsvn, windows

147 views
Skip to first unread message

Henry Hartley

unread,
Jun 8, 2011, 1:10:43 PM6/8/11
to us...@subversion.apache.org
I have VisualSVN 2.1.9 running on a Windows Server 2008. I have dumped and loaded a repository from a soon to be retiring Windows Server 2003 machine running VisualSVN 2.1.4.

I copied a working hook (post-commit.bat) from the old machine to the new and as far as I can tell, the permissions everywhere are set as they should be. Clearly, however, something is not right because the hook does not run. I get no error message in the VisualSVN Server area of the Event Viewer, so I'm not even sure the hook is firing. The repository is being updated (from Dreamweaver client).

The hook file, which is meant to update a checked out version of a web site located where the web server expects it, has the following three lines (not counting comments, also, the last two lines below are one line in the hook):

REPOS="$1"
REV="$2"
"C:\Program Files (x86)\VisualSVN Server\bin\svn" update "$REPOS"
D:/websites/wwwsite1

Running the command from the command prompt works so it still could be a permissions thing. However, the VisualSVN user has full permissions to all the repository directories as well as the directory that the hook is meant to update (D:/websites/wwwsite1).

Any ideas?

--
Henry Hartley

Lorenz

unread,
Jun 9, 2011, 1:55:54 AM6/9/11
to us...@subversion.apache.org
Henry Hartley wrote:
>I have VisualSVN 2.1.9 running on a Windows Server 2008.
>[...]

>The hook file, which is meant to update a checked out version of a web site located
>where the web server expects it, has the following three lines (not counting comments,
>also, the last two lines below are one line in the hook):
>
>>REPOS="$1"
>>REV="$2"
>>"C:\Program Files (x86)\VisualSVN Server\bin\svn" update "$REPOS"
>> D:/websites/wwwsite1

that doesn't look like a windows batch file to me.
You sure that runs from the windows command line?

Doing so on win xp gives me errors about the "REPOS=$1" and "REV=$2"
lines. And the when I correct the syntax the call to svn results in
svn trying to update $REPOS (literally!) and D:/Websites/wwwsite1


Anyway, the syntax of the update command is:

svn up <path to working copy>

no repository url/path required/allowed.
--

Lorenz

Henry Hartley

unread,
Jun 9, 2011, 11:05:25 AM6/9/11
to us...@subversion.apache.org
Lorenz wrote:
>> that doesn't look like a windows batch file to me.
>> You sure that runs from the windows command line?
>>
>> Doing so on win xp gives me errors about the "REPOS=$1" and
>> "REV=$2" lines. And the when I correct the syntax the call to svn
>> results in svn trying to update $REPOS (literally!) and
>> D:/Websites/wwwsite1
>>
>> Anyway, the syntax of the update command is:
>>
>> svn up <path to working copy>
>>
>>no repository url/path required/allowed.

I wondered about that but it worked on my old server and yes, it did run from the command line. It complained about the lines starting with # but ignored them. Looking more closely, it appears to have complained abou the REPOS=$1 line as well but ignored that, too. Finally, it seems to have ignored the "$REPOS" in the update command and updated the listed working copy.

I have now shortened the file to a single line:

"C:\Program Files (x86)\VisualSVN Server\bin\svn" up D:/websites/wwwsite1

That runs from the command line this time without any comments or warnings. So, that's good. It still doesn't run when I commit a change to the repository, though.

I did, though, get an error in the event log this time. It seems to be complaining about a username/password being unknown or incorrect. The user name displayed is my own. It's a network account that happens to be an administrator on the local machine. It occurs to me, however, that I installed VisualSVN without right-clicking and selecting "Run as Administrator." Should I have? Would that produce the problem I'm seeing?

--
Henry

Andy Levy

unread,
Jun 9, 2011, 11:46:50 AM6/9/11
to Henry Hartley, us...@subversion.apache.org


Does your repository require authentication for read operations (like
an update)? If so, the account that the hook script is running under
(the same one that VisualSVN Server is running under, probably Network
Service) doesn't have credentials cached, so the hook is being
prompted for credentials.

Pass valid credentials to svn update with --username and --password
in your hook & see what happens.

Henry Hartley

unread,
Jun 15, 2011, 12:09:12 PM6/15/11
to us...@subversion.apache.org
Andy Levy wrote:
>>
>> Pass valid credentials to svn update with --username and --password
>> in your hook & see what happens.

I'm finally getting back to this issue. Things have changed a little so here's a recap and the current situation:

I have a VisualSVN repository on a development web server with a web site properly loaded. I checked out a copy with my client (Dreamweaver CS5). I also have checked out a copy that is served as the development web site on the same machine as the repository. So far, so good.

I have a post commit hook (post-commit.bat) with the following line in it (all one line and with minor changes to protect confidentiality):

"C:\Program Files (x86)\VisualSVN Server\bin\svn" --username SVN_User --password therealpw update D:/websites/site1

After editing a file in Dreamweaver, I commit the change to the repository. The repository credentials saved in the Dreamweaver configuration are the same user and password as used in the batch file above. The commit seems to work and does not generate any error messages in the VisualSVN Server Event Log on the web server. A new file is created in db/revs/0/. However, the hook is not being executed, or if it is, it is failing without generating any error messages in the Event Viewer.

When run from the command prompt, the batch file executes without any problems and the development web site shows the update (another indication that the commit worked, obviously).

Any ideas? Is there any way to increase the logging level of VisualSVN so that it's logging everything that happens? Is there any log other than that shown in the Windows Event Viewer?

--
Henry

Konstantin Kolinko

unread,
Jun 15, 2011, 12:46:52 PM6/15/11
to Henry Hartley, us...@subversion.apache.org
2011/6/15 Henry Hartley <henryh...@westat.com>:

> Andy Levy wrote:
>>>
>>> Pass  valid credentials to svn update with --username and --password
>>> in your hook & see what happens.
>
> I'm finally getting back to this issue. Things have changed a little so here's a recap and the current situation:
>
> I have a VisualSVN repository on a development web server with a web site properly loaded. I checked out a copy with my client (Dreamweaver CS5). I also have checked out a copy that is served as the development web site on the same machine as the repository. So far, so good.
>
> I have a post commit hook (post-commit.bat) with the following line in it (all one line and with minor changes to protect confidentiality):
>
> "C:\Program Files (x86)\VisualSVN Server\bin\svn" --username SVN_User --password therealpw update D:/websites/site1

1. I'd add "--no-auth-cache --non-interactive" options as well,
and "@echo off" at the start and "exit 0" line at the end.

2. http://subversion.apache.org/faq.html#website-auto-update


3. What protocol is used by the working copy at D:/websites/site1
(file, svn, http, https)?

For https you may want "--trust-server-cert" as well.


4. What user runs the bat file?

If it is "Local System" (if I correctly remember the name), it does
not have rights to access the network.

> Is there any way to increase the logging level of VisualSVN

When debugging my hooks I used to add echo statements that wrote
something to an external log file.

Best regards,
Konstantin Kolinko

Henry Hartley

unread,
Jun 15, 2011, 1:13:16 PM6/15/11
to us...@subversion.apache.org
Konstantin Kolinko wrote
>> 2011/6/15 Henry Hartley:

>> >
>> > "C:\Program Files (x86)\VisualSVN Server\bin\svn" --username
>> > SVN_User --password therealpw update D:/websites/site1
>>
>> 1. I'd add "--no-auth-cache --non-interactive" options as well,
>> and "@echo off" at the start and "exit 0" line at the end.

I added these but it doesn't seem to have made any difference.

>> 2. http://subversion.apache.org/faq.html#website-auto-update
>>
>> 3. What protocol is used by the working copy at D:/websites/site1
>> (file, svn, http, https)?
>>
>> For https you may want "--trust-server-cert" as well.

Yes, it's using https so I've added this, also. Still no change.

>> 4. What user runs the bat file?
>>
>> If it is "Local System" (if I correctly remember the name), it
>> does not have rights to access the network.

I guess it is "Local Service" but giving that user full rights to both the repository and the checked out directory made no difference.

>> > Is there any way to increase the logging level of VisualSVN
>>
>> When debugging my hooks I used to add echo statements that wrote
>> something to an external log file.

I added a couple echo statements to the post-commit.bat file that echo into a log file. When run from the command line that log file is created and contains the echoed text. Then, when I make a change and commit, the log file is NOT created. This makes me think the batch file is never running. It seems like something would show up in the Event Viewer, however, if it failed to run because of a permission issue. So, I don't think it's really a problem with the hook itself but rather VisualSVN isn't firing the hook. Could that be?

--
Henry

Reply all
Reply to author
Forward
0 new messages