Error parsing svn output » History » Version 11

Andrey Ivanov, 2013-12-20 11:39

1 1 Anthony C
h1. Error parsing svn output
2 1 Anthony C
3 8 Toshi MARUYAMA
h2. Background
4 8 Toshi MARUYAMA
5 9 Toshi MARUYAMA
Redmine is Rails application running on web server (Apache etc.).
6 8 Toshi MARUYAMA
And Redmine calls "svn" commdand on web server.
7 8 Toshi MARUYAMA
So, you need to configure web server process *uid* correctly.
8 8 Toshi MARUYAMA
Check what your web server uid is.
9 8 Toshi MARUYAMA
(E.g. "ps -ef", "top")
10 8 Toshi MARUYAMA
11 8 Toshi MARUYAMA
h2. Introduction
12 8 Toshi MARUYAMA
13 1 Anthony C
If after adding a repository you get an error "The entry or revision was not found in the repository" on the Repository tab, check in your log folder (e.g. /var/log/redmine/default) for production.log.
14 1 Anthony C
15 2 Anthony C
If you find this error in production.log there's probably an error when the redmine user runs the svn command:
16 1 Anthony C
> Error parsing svn output: #<REXML::ParseException: No close tag for /lists/list>
17 1 Anthony C
18 1 Anthony C
(Redmine still tries to parse the output of the svn command as XML, but errors aren't formatted as XML, thus the parse error.)
19 1 Anthony C
20 1 Anthony C
To troubleshoot try running the command as the redmine user to see what the error is, for example:
21 1 Anthony C
> sudo -u www-data svn list --xml 'https://svn.server.address/reponame'@HEAD
22 1 Anthony C
23 1 Anthony C
(You may have to add "www-data ALL=(ALL) NOPASSWD:ALL" to /etc/sudoers)
24 1 Anthony C
25 1 Anthony C
Now resolve the error so that you get only clean xml from the command every time.
26 1 Anthony C
27 1 Anthony C
If you get prompted to accept the server's certificate every time you need to give the redmine user a directory to store svn configuration in. Create a directory somewhere and make sure the redmine user is owner, for example:
28 1 Anthony C
> sudo mkdir /usr/share/redmine/svn
29 3 Anthony C
30 1 Anthony C
> sudo chown www-data:www-data /usr/share/redmine/svn
31 1 Anthony C
32 7 Toshi MARUYAMA
On *Redmine 1.1.x or lesser*,
33 7 Toshi MARUYAMA
open REDMINE_ROOT/lib/redmine/scm/adapters/subversion_adapter.rb and go to line 27
34 5 Toshi MARUYAMA
35 5 Toshi MARUYAMA
 and change:
36 1 Anthony C
37 1 Anthony C
> SVN_BIN = "svn"
38 1 Anthony C
39 1 Anthony C
to, for example:
40 1 Anthony C
41 1 Anthony C
> SVN_BIN = "svn --config-dir /usr/share/redmine/svn"
42 1 Anthony C
43 1 Anthony C
Now you should be able to permanently accept the certificate.
44 5 Toshi MARUYAMA
45 5 Toshi MARUYAMA
46 7 Toshi MARUYAMA
On *Redmine 1.2 or greater*, this line changed.
47 6 Toshi MARUYAMA
48 1 Anthony C
49 10 Pierre Labrie
h2. Note for Bitnami Redmine installation on Windows
50 10 Pierre Labrie
51 11 Andrey Ivanov
The Redmine servers(*@Thin@* for versions > 2.0] by default run under the @System@ account and this does not work wrong SSL certificate for SVN server. The solution is to change the process account for a service user with logon privilege, connect to SVN and accept permanently the certificate for that user. Don't forget to change the user for the two *@Thin@* or *@Mongrel@* services running in load balancing.
52 11 Andrey Ivanov
53 11 Andrey Ivanov
Another possible solution to parliamentary accept wrong SVN certificate is to use "psexec": Command below shows console for @System account where svn command may be issued and certificate permanently accepted:
54 11 Andrey Ivanov
> psexec -i -s cmd.exe
55 10 Pierre Labrie
56 10 Pierre Labrie
Redmine code in *scm\adapter\abstact_adapter.rb* should trap connection errors and should not relies on "@No close tag for /lists/list>@" to inform us of this problem. The stderr is captured in a log when running in dev environment but not very useful in production. 
57 10 Pierre Labrie
58 4 Anonymous
h2. "SVN: Connection closed unexpectedly" when using SVN with SSH
59 4 Anonymous
60 4 Anonymous
When you execute
61 4 Anonymous
> sudo -u www-data svn list --xml 'svn+ssh://svn.server.address/reponame'@HEAD
62 4 Anonymous
63 4 Anonymous
and receive the error "SVN: Connection closed unexpectedly", you may enable the shell for the user www-data on the machine, hosting the svn repository.
64 4 Anonymous
Simply edit /etc/passwd and change the entry for the respective user so it ends with /bin/bash instead of /bin/false or /sbin/nologin.
65 4 Anonymous
This should solve the problem.
66 4 Anonymous
67 1 Anthony C
68 1 Anthony C
69 1 Anthony C