[PATCH] Re: Revised scripts

David Relson <[email protected]>
Newsgroups gmane.mail.bogofilter.devel
Organization Osage Software Systems, Inc.
Message-ID <[email protected]>
On Mon, 9 May 2005 18:43:33 +0200
Torsten Veller wrote:

> * David Relson <[email protected]>:
> 
> > # 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
_______________________________________________
Bogofilter-dev mailing list
[email protected]
http://www.bogofilter.org/mailman/listinfo/bogofilter-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.