bogofilter 0.93.4 - new current release

Matthias Andree matthias.andree at gmx.de
Tue Jan 18 12:05:18 CET 2005


Chris Wilkes <cwilkes-bf at ladro.com> writes:

> I suffered from the same lock table errors reported by others in 0.93.3
> when trying to do a bf_compact.  I updated to 0.93.4 and tried again:
>
> $ bf_compact $BOGOFILTER_DIR wordlist.db
>   mv: cannot overwrite directory `/home/vmail/maildirs/cwilkes/.bogofilter/.old/.bogofilter'
> $ rmdir /home/vmail/maildirs/cwilkes/.bogofilter/.old/.bogofilter
> $ bf_compact $BOGOFILTER_DIR wordlist.db
> mv: cannot move `/home/vmail/maildirs/cwilkes/.bogofilter/' to a
> subdirectory of itself,
> `/home/vmail/maildirs/cwilkes/.bogofilter/.old/.bogofilter'

I have revisited this problem and reproduced it. The trailing slash in
$BOGOFILTER_DIR kills the mv command off. Try ${BOGOFILTER_DIR%/}
instead, that would work.

I have committed a bf_compact fix to CVS that includes this suggestion,
this patch updates a 0.93.4 bf_compact to the current CVS version:

Index: bf_compact
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bf_compact,v
retrieving revision 1.9
retrieving revision 1.12
diff -u -r1.9 -r1.12
--- bf_compact	24 Dec 2004 22:05:15 -0000	1.9
+++ bf_compact	18 Jan 2005 10:50:26 -0000	1.12
@@ -6,7 +6,7 @@
 #    replaces original directory with new one
 #    renames original directory with '.old' extension
 
-# $Id: bf_compact,v 1.9 2004/12/24 22:05:15 relson Exp $
+# $Id: bf_compact,v 1.12 2005/01/18 10:50:26 m-a Exp $
 
 set -e # die on errors
 
@@ -15,7 +15,20 @@
     exit 1
 fi
 
-ORIG="$1"
+BOGOHOME="$1"
+
+if [ ! -d $BOGOHOME ] ; then
+    echo "$BOGOHOME must be a directory. Abort."
+    exit 1
+fi
+
+while true; do
+    case $BOGOHOME in
+	*/) BOGOHOME=${BOGOHOME%/} ;;
+	*)  break ;;
+    esac
+done
+
 if [ -z "$2" ] ; then
     FILE="wordlist.db"
 else
@@ -24,19 +37,18 @@
 
 TEMP="bf_compact.$$"
 
-if [ -d $TEMP ] ; then
-    echo Directory $TEMP already exists.
-    echo exiting.
+if ! mkdir "$TEMP" ; then
+    echo "Cannot create directory $TEMP. Abort."
     exit 1
-else
-    mkdir $TEMP
 fi
 
-if test -f "$ORIG"/DB_CONFIG ; then cp -p "$ORIG"/DB_CONFIG "$TEMP" ; fi
-bogoutil -d "$ORIG"/"$FILE" | bogoutil -l $TEMP/"$FILE"
+if test -f "$BOGOHOME"/DB_CONFIG ; then
+    cp -p "$BOGOHOME"/DB_CONFIG "$TEMP"/
+fi
+bogoutil -d "$BOGOHOME"/"$FILE" | bogoutil -l $TEMP/"$FILE"
 
 #checkpoint and remove unneeded log files
 bogoutil --db-prune=$TEMP
 
-mv "$ORIG" "$ORIG.old"
-mv  $TEMP  "$ORIG"
+mv "$BOGOHOME" "$BOGOHOME.old"
+mv  $TEMP      "$BOGOHOME"

-- 
Matthias Andree



More information about the Bogofilter mailing list