[PATCH] Re: Revised scripts

David Relson relson at osagesoftware.com
Mon May 9 23:24:41 CEST 2005


On Mon, 9 May 2005 18:43:33 +0200
Torsten Veller wrote:

> * David Relson <relson at osagesoftware.com>:
> 
> > # Usage: bf_resize [DIR]
> > #   DIR defaults to . and is the path of a bogofilter Berkeley database
> > #   environment.
> > #
> > # This script reads all databases in that directory, calculates a lock
> > # size and writes it to DB_CONFIG, then runs recovery to make the change
> > # effective.
> > 
> > set -e
> > 
> > BOGOHOME=${1:-.}
> > 
> > if [ ! -d "$BOGOHOME" ] ; then
> >     echo $BOGOHOME must be a directory, not a file
> >     exit 1
> > fi
> > 
> > # obtain list of database files
> > PAGES=0
> > DATABASES=`bogofilter -QQ -d "$BOGOHOME" | grep '^wordlist' | cut -f3 -d,`
> > if [ ! "$dbs" ] ; then
>            ^^^ I think it should be DATABASES?
> 
> but when is DATABASES empty?
> 
> $ mkdir testdir
> $ bogofilter -QQ -d testdir | grep '^wordlist'
> wordlist             r,word,testdir/wordlist.db,0
> 
> >     echo >&2 "No database files in \"$BOGOHOME\" found"
> >     exit 1
> > fi
> [...]

Torsten,

Good catch.  I've fixed the problem in CVS.  Here's the patch:

--- bf_resize.in.orig	2005-05-08 16:09:53.000000000 -0400
+++ bf_resize.in	2005-05-09 17:21:13.000000000 -0400
@@ -13,6 +13,8 @@
 # size and writes it to DB_CONFIG, then runs recovery to make the change
 # effective.
 
+# $Id: bf_resize.in,v 1.2 2005/05/09 21:21:13 relson Exp $
+
 set -e
 
 BOGOHOME=${1:-.}
@@ -25,7 +27,7 @@
 # obtain list of database files
 PAGES=0
 DATABASES=`bogofilter -QQ -d "$BOGOHOME" | grep '^wordlist' | cut -f3 -d,`
-if [ ! "$dbs" ] ; then
+if [ -z "$DATABASES" ] ; then
     echo >&2 "No database files in \"$BOGOHOME\" found"
     exit 1
 fi



More information about the bogofilter-dev mailing list