Subject: | Segfault when adding a valuerangeprocessor in certain conditions |
I have written two testcases where one fails and one passes, depending
on where I add the value range processor.
This is perl, v5.8.8 built for darwin-2level
Darwin Kernel Version 8.9.1 i386
Subject: | vrp_broken_tests.diff |
diff -urN Search-Xapian-1.0.0.0/t/lib/Wrapper.pm Search-Xapian-1.0.0.0.bug/t/lib/Wrapper.pm
--- Search-Xapian-1.0.0.0/t/lib/Wrapper.pm 1970-01-01 01:00:00.000000000 +0100
+++ Search-Xapian-1.0.0.0.bug/t/lib/Wrapper.pm 2007-06-14 10:11:49.000000000 +0200
@@ -0,0 +1,28 @@
+package Wrapper;
+
+use strict;
+use warnings;
+use Moose;
+use Search::Xapian qw(:standard);
+
+has 'index' => (isa => 'Str', is => 'rw', default => 'testdb');
+has 'language' => (isa => 'Str', is => 'rw', default => 'en');
+has 'db' => (isa => 'Search::Xapian::Database', is => 'rw') ;
+has 'qp' => (isa => 'Search::Xapian::QueryParser', is => 'rw');
+
+sub BUILD {
+ my $self = shift;
+ $self->db(Search::Xapian::WritableDatabase->new());
+ $self->qp(Search::Xapian::QueryParser->new($self->db));
+
+ my $stemmer=Search::Xapian::Stem->new($self->language);
+ $self->qp->set_stemmer($stemmer);
+ $self->qp->set_stemming_strategy(STEM_SOME);
+ $self->qp->set_default_op(OP_AND);
+
+ $self->qp->add_boolean_prefix("site", "H");
+ $self->qp->add_boolean_prefix("id", "Q");
+
+}
+
+1;
\ No newline at end of file
diff -urN Search-Xapian-1.0.0.0/t/lib/Wrapper2.pm Search-Xapian-1.0.0.0.bug/t/lib/Wrapper2.pm
--- Search-Xapian-1.0.0.0/t/lib/Wrapper2.pm 1970-01-01 01:00:00.000000000 +0100
+++ Search-Xapian-1.0.0.0.bug/t/lib/Wrapper2.pm 2007-06-14 10:11:45.000000000 +0200
@@ -0,0 +1,16 @@
+package Wrapper2;
+
+use strict;
+use warnings;
+use Moose;
+use Search::Xapian qw(:standard);
+
+extends 'Wrapper';
+
+sub BUILD {
+ my $self = shift;
+ my $vrp = Search::Xapian::StringValueRangeProcessor->new(1);
+ $self->qp->add_valuerangeprocessor($vrp);
+}
+
+1;
\ No newline at end of file
diff -urN Search-Xapian-1.0.0.0/t/x_vrp.t Search-Xapian-1.0.0.0.bug/t/x_vrp.t
--- Search-Xapian-1.0.0.0/t/x_vrp.t 1970-01-01 01:00:00.000000000 +0100
+++ Search-Xapian-1.0.0.0.bug/t/x_vrp.t 2007-06-14 10:12:56.000000000 +0200
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+use lib qw(t/lib);
+use Wrapper;
+
+my $q = "1170288000..1181567637";
+
+my $db = Wrapper->new();
+
+my $qp = $db->qp;
+
+my $vrp = Search::Xapian::StringValueRangeProcessor->new(1);
+$qp->add_valuerangeprocessor($vrp);
+
+isa_ok($qp, "Search::Xapian::QueryParser");
+my $query = $qp->parse_query($q);
+ok(1, "parse_query worked");
+
+is($query->get_description, "Xapian::Query(VALUE_RANGE 1 1170288000 1181567637)");
diff -urN Search-Xapian-1.0.0.0/t/x_vrp_2.t Search-Xapian-1.0.0.0.bug/t/x_vrp_2.t
--- Search-Xapian-1.0.0.0/t/x_vrp_2.t 1970-01-01 01:00:00.000000000 +0100
+++ Search-Xapian-1.0.0.0.bug/t/x_vrp_2.t 2007-06-14 10:13:06.000000000 +0200
@@ -0,0 +1,19 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+use lib qw(t/lib);
+use Wrapper2;
+
+my $q = "1170288000..1181567637";
+
+my $db = Wrapper2->new();
+
+my $qp = $db->qp;
+
+isa_ok($qp, "Search::Xapian::QueryParser");
+my $query = $qp->parse_query($q);
+ok(1, "parse_query worked");
+
+is($query->get_description, "Xapian::Query(VALUE_RANGE 1 1170288000 1181567637)");