Error parsing svn output » History » Version 10

« Previous - Version 10/12 (diff) - Next » - Current version
Pierre Labrie, 2012-11-08 17:40
Note for Bitnami Redmine installation on Windows


Error parsing svn output

Background

Redmine is Rails application running on web server (Apache etc.).
And Redmine calls "svn" commdand on web server.
So, you need to configure web server process uid correctly.
Check what your web server uid is.
(E.g. "ps -ef", "top")

Introduction

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.

If you find this error in production.log there's probably an error when the redmine user runs the svn command:

Error parsing svn output: #<REXML::ParseException: No close tag for /lists/list>

(Redmine still tries to parse the output of the svn command as XML, but errors aren't formatted as XML, thus the parse error.)

To troubleshoot try running the command as the redmine user to see what the error is, for example:

sudo -u www-data svn list --xml 'https://svn.server.address/reponame'@HEAD

(You may have to add "www-data ALL=(ALL) NOPASSWD:ALL" to /etc/sudoers)

Now resolve the error so that you get only clean xml from the command every time.

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:

sudo mkdir /usr/share/redmine/svn

sudo chown www-data:www-data /usr/share/redmine/svn

On Redmine 1.1.x or lesser,
open REDMINE_ROOT/lib/redmine/scm/adapters/subversion_adapter.rb and go to line 27
source:tags/1.1.3/lib/redmine/scm/adapters/subversion_adapter.rb#L27
and change:

SVN_BIN = "svn"

to, for example:

SVN_BIN = "svn --config-dir /usr/share/redmine/svn"

Now you should be able to permanently accept the certificate.

TODO:
On Redmine 1.2 or greater, this line changed.
source:tags/1.2.3/lib/redmine/scm/adapters/subversion_adapter.rb#L35

Note for Bitnami Redmine installation on Windows

The Redmine servers(Thin for versions > 2.0] by default run under the System account and there is no way to accept permanently the certificate for SVN. 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.

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.

"SVN: Connection closed unexpectedly" when using SVN with SSH

When you execute

sudo -u www-data svn list --xml 'svn+ssh://svn.server.address/reponame'@HEAD

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.
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.
This should solve the problem.

Source(s):
http://www.redmine.org/boards/2/topics/11896
http://www.thinkplexx.com/learn/howto/scm/svn/fix-permanent-error-validating-server-certificate-problem-with-subversion