From 587c1d5cac956ec0cf482fc14ecea40240e85fd8 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 10 Dec 2002 12:54:24 +0000 Subject: [PATCH] Fixed bug in sort for unset entries at end of sort file. --- configure.in | 4 ++-- debian/changelog | 6 ++++++ index/sortidx.c | 6 ++++-- test/Makefile.am | 2 +- test/sort/Makefile.am | 4 ++++ test/sort/my.abs | 14 ++++++++++++++ test/sort/rec1.xml | 4 ++++ test/sort/rec2.xml | 4 ++++ test/sort/rec3.xml | 3 +++ test/sort/test1.sh | 26 ++++++++++++++++++++++++++ test/sort/zebra.cfg | 15 +++++++++++++++ test/testclient.c | 5 ++--- 12 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 test/sort/Makefile.am create mode 100644 test/sort/my.abs create mode 100644 test/sort/rec1.xml create mode 100644 test/sort/rec2.xml create mode 100644 test/sort/rec3.xml create mode 100755 test/sort/test1.sh create mode 100644 test/sort/zebra.cfg diff --git a/configure.in b/configure.in index 6a49836..0b13369 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Zebra, Index Data Aps, 1995-2002 -dnl $Id: configure.in,v 1.59 2002-11-26 21:45:28 adam Exp $ +dnl $Id: configure.in,v 1.60 2002-12-10 12:54:24 adam Exp $ dnl AC_INIT(include/zebraver.h) AM_INIT_AUTOMAKE(idzebra,1.3.4) @@ -334,7 +334,7 @@ AC_OUTPUT([ doc/tkl.xsl test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile perl/Makefile.PL - test/dmoz/Makefile test/xpath/Makefile + test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile examples/Makefile examples/gils/Makefile ]) diff --git a/debian/changelog b/debian/changelog index 2b28a05..5363ac4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +idzebra (1.3.4-2) unstable; urgency=low + + * Fixed bug in sort for unset entries at end of sort file. + + -- Adam Dickmeiss Tue, 10 Dec 2002 13:53:10 +0100 + idzebra (1.3.4-1) unstable; urgency=low * Upstream. diff --git a/index/sortidx.c b/index/sortidx.c index 9524b97..fe55828 100644 --- a/index/sortidx.c +++ b/index/sortidx.c @@ -1,4 +1,4 @@ -/* $Id: sortidx.c,v 1.7 2002-08-02 19:26:55 adam Exp $ +/* $Id: sortidx.c,v 1.8 2002-12-10 12:54:24 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -138,5 +138,7 @@ void sortIdx_add (SortIdx si, const char *buf, int len) void sortIdx_read (SortIdx si, char *buf) { - bf_read (si->current_file->bf, si->sysno+1, 0, 0, buf); + int r = bf_read (si->current_file->bf, si->sysno+1, 0, 0, buf); + if (!r) + memset (buf, 0, SORT_IDX_ENTRYSIZE); } diff --git a/test/Makefile.am b/test/Makefile.am index 8ef10be..1b7443b 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS=gils usmarc api dmoz xpath +SUBDIRS=gils usmarc api dmoz xpath sort testclient_SOURCES = testclient.c diff --git a/test/sort/Makefile.am b/test/sort/Makefile.am new file mode 100644 index 0000000..b00e9b4 --- /dev/null +++ b/test/sort/Makefile.am @@ -0,0 +1,4 @@ +TESTS = test1.sh + +EXTRA_DIST = $(TESTS) zebra.cfg rec1.xml rec2.xml rec3.xml zebra.cfg my.abs + diff --git a/test/sort/my.abs b/test/sort/my.abs new file mode 100644 index 0000000..1ade037 --- /dev/null +++ b/test/sort/my.abs @@ -0,0 +1,14 @@ +# $Id: my.abs,v 1.1 2002-12-10 12:54:24 adam Exp $ + +name my +reference WAIS-schema +attset bib1.att +tagset generic.tag + +varset var1.var + +esetname B @ +esetname F @ + +elm (2,1) Title !:p,!:w +elm (2,8) Date !:s diff --git a/test/sort/rec1.xml b/test/sort/rec1.xml new file mode 100644 index 0000000..781d74a --- /dev/null +++ b/test/sort/rec1.xml @@ -0,0 +1,4 @@ + + first computer + 2 + diff --git a/test/sort/rec2.xml b/test/sort/rec2.xml new file mode 100644 index 0000000..fa58c19 --- /dev/null +++ b/test/sort/rec2.xml @@ -0,0 +1,4 @@ + + second computer + 1 + diff --git a/test/sort/rec3.xml b/test/sort/rec3.xml new file mode 100644 index 0000000..2b44c52 --- /dev/null +++ b/test/sort/rec3.xml @@ -0,0 +1,3 @@ + + third computer + diff --git a/test/sort/test1.sh b/test/sort/test1.sh new file mode 100755 index 0000000..62b428a --- /dev/null +++ b/test/sort/test1.sh @@ -0,0 +1,26 @@ +#!/bin/sh +LOG=test1.log +rm -fr lock +mkdir lock +rm -fr reg +mkdir reg +rm -fr recs +mkdir recs +cp rec*.xml recs +../../index/zebraidx -l $LOG update recs || exit 1 +../../index/zebrasrv -l $LOG unix:socket & +sleep 1 +test -f zebrasrv.pid || exit 2 +../testclient -n3 unix:socket '@or computer @attr 7=1 @attr 1=30 0' >tmp1 +echo 'Result count: 3 +my: + title: third computer +my: + title: second computer + dateTime: 1 +my: + title: first computer + dateTime: 2' >tmp2 + +kill `cat zebrasrv.pid` +diff tmp1 tmp2 diff --git a/test/sort/zebra.cfg b/test/sort/zebra.cfg new file mode 100644 index 0000000..f91a9ad --- /dev/null +++ b/test/sort/zebra.cfg @@ -0,0 +1,15 @@ +# Simple Zebra configuration file +# $Id: zebra.cfg,v 1.1 2002-12-10 12:54:24 adam Exp $ +# +# Where the schema files, attribute files, etc are located. +profilePath: .:../../tab + +# Files that describe the attribute sets supported. +attset: bib1.att +attset: explain.att + +recordtype.xml: grs.sgml +recordId: file +lockdir: lock +register: reg:20M +isam: b diff --git a/test/testclient.c b/test/testclient.c index eec7ff1..e40b97a 100644 --- a/test/testclient.c +++ b/test/testclient.c @@ -1,5 +1,5 @@ /* - * $Id: testclient.c,v 1.7 2002-11-11 15:41:19 heikki Exp $ + * $Id: testclient.c,v 1.8 2002-12-10 12:54:24 adam Exp $ * * Z39.50 client specifically for Zebra testing. */ @@ -59,7 +59,7 @@ int main(int argc, char **argv) default: printf ("%s: unknown option %s\n", prog, arg); printf ("usage:\n%s [options] target query \n", prog); - printf (" eg. bagel.indexdata.dk/gils computer\n"); + printf (" eg. indexdata.dk/gils computer\n"); exit (1); } } @@ -74,7 +74,6 @@ int main(int argc, char **argv) printf (" -o off offset for records - counting from 0.\n"); printf (" -f format set record syntax. Default: none\n"); printf (" -d sec delay a number of seconds before exit.\n"); - printf ("Options\n"); exit (3); } z = ZOOM_connection_new (target, 0); -- 1.7.10.4