[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Bugs in Subversion's SWIG 1.3.21 support

From: David James <james82_at_gmail.com>
Date: 2005-08-02 06:12:54 CEST

On my machine (Linux 2.4, using Subversion trunk or 1.2.1), the
"svnlook.py" script crashes if you run it on a nonempty repository
using SWIG 1.3.21. Here's a crash recipe (to be run from within the
tools/examples subdirectory):
  svnadmin create repo
  python putfile.py putfile.py repo
  python svnlook.py repo

This SWIG 1.3.21 bug also causes the Trac test suite to crash with
both Subversion 1.2.1 and Subversion trunk.

(NOTE: This is a bug that affects SWIG 1.3.20 and SWIG 1.3.21 only.
Other supported versions of SWIG, including SWIG 1.3.19, SWIG 1.3.24,
and SWIG 1.3.25 are unaffected.)

After investigating this problem, I narrowed it down to a problem
inside the make_pointer function in swigutil_py.c:
  static PyObject *make_pointer(const char *typename, void *ptr)
  {
    /* ### cache the swig_type_info at some point? */
    return SWIG_NewPointerObj(ptr, SWIG_TypeQuery(typename), 0);
  }

The problem: SWIG 1.3.21 isn't that great at TypeQuery lookups. For
example, if you ask for "svn_fs_root_t *", SWIG_TypeQuery returns
NULL. When you pass the NULL pointer into SWIG_NewPointerObj, it
segfaults.

Do other people also notice this problem? This looks like it's a bug
in SWIG, and it'll be difficult to work around. If other people also
notice this bug, I'd suggest we take one of three options:
1) Find some way to make Subversion and SWIG 1.3.20 and SWIG 1.3.21's
runtime lookup system work well together.
2) Avoid runtime type lookups altogether. Redesign Subversion's SWIG
library to use compile-time lookups instead.
3) Drop support for SWIG 1.3.20 and 1.3.21.

Opinions?

Cheers,

David

P.S. Before testing with SWIG 1.3.21, be careful to delete all
Python/SWIG-related files so that you don't accidentally test the
wrong version of SWIG. The 'make clean' rule in Subversion does not do
the job, because it does not delete Python/SWIG related files
properly.

Here is the build process I used to build and install SWIG:
./autogen.sh && ./configure --enable-static && make && make install &&
make runtime && make install-runtime

The "--enable-static" flag and the runtime installation targets are
essential with early versions of SWIG, but are not necessary with SWIG
1.3.24 and up.

-- 
David James -- http://www.cs.toronto.edu/~james
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 2 06:13:42 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.