uncaught C++ exception from Perl Search::Xapian XS?

Olly Betts olly at survex.com
Tue Mar 28 03:24:33 BST 2023


On Mon, Mar 27, 2023 at 11:46:04AM +0000, Eric Wong wrote:
> I'm using Search::Xapian XS from Debian stable and I'm getting what
> appears to be an unwrapped C++ exception:
> 
>   terminate called after throwing an instance of 'Xapian::DatabaseModifiedError'
> 
> Using `eval' from Perl5 doesn't seem effective in catching it.
> 
> I'm using postlist_begin, postlist_end and ++ to iterate a
> PositionIterator, and reading XS/*Iterator.xs, I see the XS
> wrappers are missing:

FWIW, postlist_begin gives you a PostingIterator (positionlist_begin
would give you a PositionIterator).

>   try { } catch { handle_exception(); }
> 
> in several places.  Not sure if that's it or if something
> else (I know C, but am not remotely fluent in C++).

That is indeed what's missing.

I'm open to clean patches to address issues in Search::Xapian still,
but it's probably simplest to use the Perl bindings from
xapian-bindings, which do handle exceptions here (the exception handling
is generated automatically).

This is unlikely to be something that we can fix in a debian stable
release (because it doesn't seem to fit Debian's release critical bug
definition), so you'll need to build your own bindings rather than using
the package from debian stable.

Cheers,
    Olly



More information about the Xapian-discuss mailing list