|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58294 svn_ fs_ revision_ root causes seg fault
Submitted: 2008-07-29 06:25 UTC Modified: 2008-09-02 08:08 UTC
From: arty at lightenna dot com Assigned: scottmac (profile)
Status: Closed Package: svn (PECL)
PHP Version: 5_2 CVS-2008-07-29 (dev) OS: CentOS 5 64-bit 2.6.18-53.1.21
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: arty at lightenna dot com
New email:
PHP Version: OS:


 [2008-07-29 06:25 UTC] arty at lightenna dot com
When executing the following code on PHP 5.2.6 (CLI or through Apache) I get a segmentation fault. Here is the output I get:

% php test_svn.php
Opening lock on a repo...
resource(4) of type (svn-repos)
Getting file system handle...
resource(5) of type (svn-fs)
HEAD Revision: 1
Geting revision root handle...
Segmentation fault

Reproduce code:
echo "Opening lock on a repo...\n";
$lock = svn_repos_open('/var/svn_repos/my_repo');
echo "Getting file system handle...\n";
$fs = svn_repos_fs($lock);
$head = svn_fs_youngest_rev($fs);
echo "HEAD Revision: $head\n";
echo "Geting revision root handle...\n";
$root = svn_fs_revision_root($fs, $head);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-07 11:04 UTC] j0j0 at riod dot ca
I'm getting the same behaviour on CentOS 5 32-bit.

Linux kaitlin 2.6.18-53.1.19.el5 #1 SMP Wed May 7 08:20:19 EDT 2008 i686 athlon i386 GNU/Linux
 [2008-08-15 08:00 UTC] alexander_bottema at hotmail dot com
I have the same problem on Windows XP 32-bit / Intel.

Opening lock on a repo...
resource(4) of type (svn-repos)
Getting file system handle...
resource(5) of type (svn-fs)
HEAD Revision: 116
Geting revision root handle...

 [2008-08-26 09:06 UTC] alexander_bottema at hotmail dot com
It was a pain, but I finally got PHP_SVN to compile on Windows XP in order to debug this issue. (PEAR doesn't work on Windows, so I had to create my own BAT-script that compiles this module).

I used php-5.2.6 and svn-1.3.2. I tracked this problem to function svn_repos_open at svn.c:1823:


It seems that the pool allocated for svn_repos_open() is destroyed no matter what. It should not destroy the pool if the function is successful and registers the resource. Therefore, I moved svn_pool_destroy(subpool) inside the RETVAL_FALSE branch of the if-statement.

Developers of PHP_SVN should confirm.

 [2008-08-26 09:10 UTC] alexander_bottema at hotmail dot com
Sorry, the exact line number may not be correct as I added some printf() statements here and there, but you'll get the idea.
 [2008-09-02 06:52 UTC]
The resource comes from the main pool and not the subpool. The subpool is only used for path canonicalisation.

In future you should be able to create a debug build and use gdb to get a backtrace on linux.
 [2008-09-02 08:08 UTC]
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

I never noticed the resource took a copy of the subpool that it used later on, I've stopped destroying the subpool and let the resource destructor handle it.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 01 16:03:38 2023 UTC