Indefero

Issue 469: Still problems with SVN and log files

Reported by Nikolaus Schaller, May 24, 2010

I just upgraded to 1.0 (on Mac OS X Server 10.6.3) but still have 
problems accessing a remote SVN repository. I receive an e-mail:

PlufErrorHandlerException making GET request to 
/p/swk/source/tree/HEAD/
2 : simplexml_load_string(): Entity: line 3: parser error : 
Premature end of data in tag log line 2

PHP: 
/Library/WebServer/Sites/projects.goldelico.com/indefero/src/IDF/Scm/
Svn.php, line 244
URI: GET /p/swk/source/tree/HEAD/

The repository referred to is public so anonymous access should be 
possible for testing purposes

Repository type:	Subversion
Repository access:	
svn://svn.gna.org/svn/gnustep/libs/simplewebkit/trunk

The command

svn log svn://svn.gna.org/svn/gnustep/libs/simplewebkit/trunk

on a console works fine. So I suspect that a incompatible svn 
command is issued.

Comment 1 by Loïc d'Anterroches, May 25, 2010

Nikolaus, can you please provide your $cfg['svn_repositories'] 
config variable? The svn protocol has never been tested and this 
could be the reason (only file:// for the svn_repositories path and 
http(s) for the remote repositories).
Labels: Type:Support Type:Defect

Comment 2 by Nikolaus Schaller, May 25, 2010

You are right:

$cfg['svn_repositories'] = '
file:///Library/WebServer/Sites/svn.goldelico.com/repositories/%s';
$cfg['svn_remote_url'] = 'http://svn.goldelico.com/%s';

So the logic might think a svn:// repository is local. A svn log to 
a file:// with the svn:// appended gives an error...

I have tried to add a log command just before the shell_exec() is 
called. The result is:

/opt/local/bin/svn log --xml --limit 1 -v --username='' 
--password='' '
svn://svn.gna.org/svn/gnustep/libs/simplewebkit/trunk'@'HEAD'
/opt/local/bin/svn ls --xml --username='' --password='' '
svn://svn.gna.org/svn/gnustep/libs/simplewebkit/trunk//'@'HEAD'
/opt/local/bin/svn log --xml --limit 1 --username='' --password='' '
svn://svn.gna.org/svn/gnustep/libs/simplewebkit/trunk'@'30431'
/opt/local/bin/svn log --xml --limit 1 --username='' --password='' '
svn://svn.gna.org/svn/gnustep/libs/simplewebkit/trunk'@'24805'
The server encountered an unexpected condition which prevented it 
from fulfilling your request.

An email has been sent to the administrators, we will correct this 
error as soon as possible. Thank you for your comprehension.

500 - Internal Server Error

The console output of /opt/local/bin/svn log --xml --limit 1 
--username='' --password='' '
svn://svn.gna.org/svn/gnustep/libs/simplewebkit/trunk'@'24805' is:

$ /opt/local/bin/svn log --xml --limit 1 --username='' --password='' 
'svn://svn.gna.org/svn/gnustep/libs/simplewebkit/trunk'@'24805'
<?xml version="1.0"?>
<log>
svn: File not found: revision 24805, path '/libs/simplewebkit/trunk'

So there is a request for a non-existing revision and processing of 
such a case fails.

What I could find out is that the revision 24816 of this repository 
tells something about moving the whole tree. And this is the first 
one for which the log command works fine. I now think there is 
something a little corrupt in the repository. But I have no means to 
fix it on the server...

So we should find a solution how the Svn.php plugin handles this 
case more gracefully (e.g. just say that the revision can not be 
found on the server instead of aborting completely).

As far as I understand the svn command that are issued, the svn ls 
is used to list all known revisions and svn log  commands to collect 
details for each one.

Comment 3 by Nikolaus Schaller, May 25, 2010

Loic, I have found a simple fix for Svn.php:

    private function getCommitMessage($rev='HEAD')
    {
        if (isset($this->cache['commitmess'][$rev])) {
            return $this->cache['commitmess'][$rev];
        }
        $cmd = sprintf(Pluf::f('svn_path', 'svn').' log --xml 
--limit 1 --username=%s --password=%s %s@%s',
                       escapeshellarg($this->username),
                       escapeshellarg($this->password),
                       escapeshellarg($this->repo),
                       escapeshellarg($rev));
        $cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
		$xmlInfo = self::shell_exec('IDF_Scm_Svn::getCommitMessage', 
$cmd);
        try {
            $xml = simplexml_load_string($xmlInfo);
			$this->cache['commitmess'][$rev] = (string) 
$xml->logentry->msg;
        }
        catch (Exception $e) {
            $this->cache['commitmess'][$rev] = "*** server 
error ***";
        }
        return $this->cache['commitmess'][$rev];
    }

Please look for results at

http://projects.goldelico.com/p/swk/source/tree/HEAD/

Comment 4 by Loïc d'Anterroches, May 25, 2010

Another question. How where you able to get a "svn://" url 
for your repository? It is normally accepting only http(s) through 
the GUI.

Comment 5 by Nikolaus Schaller, May 25, 2010

Hm. I don't remember. Most probably I did it by editing the database 
manually...

Comment 6 by Brian Armstrong, Jun 9, 2010

I think this may be related to issue 364

Comment 7 by Thomas Keller, Mar 18, 2011

This problem was fixed in commit be39d72d3c28. The commit log is 
kept empty in the error case, though. Dupe of issue 518.
Labels: Milestone:Release1.1
Status: Fixed

Created: 2 years 11 months ago by Nikolaus Schaller

Updated: 2 years 2 months ago

Status: Fixed

Followed by: 3 persons

Labels:
Priority:Medium
Type:Support
Milestone:Release1.1