[Xapian-discuss] Quartzcompact in svn-6307 fails

Olly Betts olly at survex.com
Fri Jun 24 11:03:57 BST 2005


On Fri, Jun 24, 2005 at 10:07:31AM +0200, Arjen van der Meijden wrote:
> Hmm, appareantly the database wasn't transferred from the original 
> machine to the development one correctly, I'll test it again and I don't 
> think you'd worry too much about this. Although the segfault should not 
> occur of course.

Unfortunately the backtrace isn't really enough for me to see why it is
segfaulting.

You could try the attached patch.

Alternatively, if it does it early on in the run, and this is x86 linux,
then running under valgrind is probably the simplest way to get more
information.

Cheers,
    Olly
-------------- next part --------------
Index: backends/quartz/btree.cc
===================================================================
--- backends/quartz/btree.cc	(revision 6305)
+++ backends/quartz/btree.cc	(working copy)
@@ -598,12 +598,15 @@
 {
     DEBUGCALL(DB, void, "Btree::compact", (void*)p);
     Assert(writable);
+    if (p == 0) abort();
+    if (buffer == 0) abort();
     int e = block_size;
     byte * b = buffer;
     int dir_end = DIR_END(p);
     for (int c = DIR_START; c < dir_end; c += D2) {
 	Item item(p, c);
 	int l = item.size();
+	if (e < dir_end) abort();
 	e -= l;
 	memmove(b + e, item.get_address(), l);
 	SETD(p, c, e);  /* reform in b */


More information about the Xapian-discuss mailing list