[PATCH] was: t.probe ...
David Relson
relson at osagesoftware.com
Sun May 1 21:49:24 CEST 2005
On Sun, 1 May 2005 16:08:08 -0300
Andreas Hasenack wrote:
> On Sun, May 01, 2005 at 02:13:33PM -0400, David Relson wrote:
> > > PASS: t.multiple.wordlists
> > > Database handles open during environment close
> > > DB_ENV->close(0x80747c0): Invalid argument
> > > Can't open file 'wordlist.db' in directory './checks.27316.20050501T150147'.
> > > error #2 - No such file or directory.
> > >
> > > Remember to register some spam and ham messages before you
> > > use bogofilter to evaluate mail for its probable spam status!
> > > FAIL: t.probe
> >
> > Andreas,
> >
> > You're building with --enable-transactions or --disable-transactions,
> > correct? t.probe expects AUTO-XA mode and fails if it's not being
> > used, as in your case. I'll see if I can change it so that it behaves
> > more politely.
>
> Correct, I'm using --enable-transactions.
Andreas,
I've done a bit of testing (with --disable-transactions) and it looks
like another change or two may be in order. Attached is a patch from
0.94.7 to the current cvs version. It may help in what you're doing.
David
P.S. I notice that you have a connectiva address. Is that significant?
-------------- next part --------------
diff -u -r --exclude-from=diff.excl 0947/configure.ac cvs/configure.ac
--- 0947/configure.ac 2005-04-30 08:47:35.000000000 -0400
+++ cvs/configure.ac 2005-05-01 14:07:58.000000000 -0400
@@ -1,6 +1,6 @@
-# $Id: configure.ac,v 1.349 2005/04/30 12:47:35 relson Exp $
+# $Id: configure.ac,v 1.350 2005/05/01 18:07:58 relson Exp $
dnl vim: set noai tw=0:
-AC_INIT(bogofilter, 0.94.7)
+AC_INIT(bogofilter, 0.94.7.cvs)
AC_PREREQ(2.54)
AC_CONFIG_SRCDIR([src/bogofilter.c])
AC_CANONICAL_TARGET
diff -u -r --exclude-from=diff.excl 0947/doc/bogofilter.xml cvs/doc/bogofilter.xml
--- 0947/doc/bogofilter.xml 2005-04-28 07:22:45.000000000 -0400
+++ cvs/doc/bogofilter.xml 2005-04-30 21:56:44.000000000 -0400
@@ -222,9 +222,11 @@
that can be rewound, bogofilter will read it a second time.</para>
<para>The <option>-e</option> (embed) option tells
-<application>bogofilter</application> to exit with code 0 unless there
-was an error (even if the mail is not spam or classified as unsure).
-This simplifies using bogofilter from procmail or maildrop.</para>
+<application>bogofilter</application> to exit with code 0 if the
+message can be classified, i.e. if there is not an error. Normally
+bogofilter uses different codes for spam, ham, and unsure
+classifications, but this simplifies using bogofilter with procmail or
+maildrop.</para>
<para>The <option>-t</option> (terse) option tells
<application>bogofilter</application> to print an abbreviated
diff -u -r --exclude-from=diff.excl 0947/src/datastore_db.c cvs/src/datastore_db.c
--- 0947/src/datastore_db.c 2005-04-29 23:29:13.000000000 -0400
+++ cvs/src/datastore_db.c 2005-05-01 15:44:39.000000000 -0400
@@ -1,4 +1,4 @@
-/* $Id: datastore_db.c,v 1.209 2005/04/30 03:29:13 relson Exp $ */
+/* $Id: datastore_db.c,v 1.212 2005/05/01 19:44:39 relson Exp $ */
/*****************************************************************************
@@ -95,6 +95,14 @@
return buf;
}
+static void set_txn_mode(void)
+{
+ if (eTransaction == T_DEFAULT_OFF)
+ eTransaction = T_DISABLED;
+ if (eTransaction == T_DEFAULT_ON)
+ eTransaction = T_ENABLED;
+}
+
#if !defined(ENABLE_TRANSACTIONS) && !defined(DISABLE_TRANSACTIONS)
static const char *txn2str(e_txn txn)
{
@@ -138,11 +146,6 @@
}
/* else use default txnue */
- if (txn == T_DEFAULT_OFF)
- txn = T_DISABLED;
- if (txn == T_DEFAULT_ON)
- txn = T_ENABLED;
-
if (DEBUG_DATABASE(1))
fprintf(dbgout, "\n");
@@ -267,12 +270,16 @@
eTransaction = get_txn_state(bfp);
+ set_txn_mode();
+
if (eTransaction == T_DISABLED)
dsm = &dsm_traditional;
else
dsm = &dsm_transactional;
#else
(void)bfp;
+
+ set_txn_mode();
#endif
}
@@ -509,7 +516,8 @@
#if !defined(ENABLE_TRANSACTIONS) && !defined(DISABLE_TRANSACTIONS)
strcat(v, " AUTO-XA");
#else
- if (eTransaction == P_ENABLED)
+ set_txn_mode();
+ if (eTransaction == T_ENABLED)
strcat(v, " TRANSACTIONAL");
else
strcat(v, " NON-TRANSACTIONAL");
diff -u -r --exclude-from=diff.excl 0947/src/tests/t.probe cvs/src/tests/t.probe
--- 0947/src/tests/t.probe 2005-04-29 17:28:49.000000000 -0400
+++ cvs/src/tests/t.probe 2005-05-01 14:39:30.000000000 -0400
@@ -3,8 +3,26 @@
# verify that --db-transaction option is given
# precedence over probing for a database environment
+# to create a wordlist without transaction files:
+#
+# bogofilter -d dir -n < /dev/null
+#
+# or:
+#
+# bogofilter -d dir -n --db-transaction=no < /dev/null
+#
+# to create a wordlist with transaction files, or
+# to convert to a wordlist with transaction files
+#
+# bogofilter -d dir -n --db-transaction=yes < /dev/null
+
. ${srcdir=.}/t.frame
+AUTO_XA=`$BOGOFILTER -C -V 2>&1 | sed -n '2p;' | grep AUTO-XA || :`
+if [ -z "$AUTO_XA" ]; then
+ exit 77
+fi
+
OUT=${TMPDIR}/test.out
MSG=${TMPDIR}/test.msg
LOG=${BOGOFILTER_DIR}/log.0000000001
diff -u -r --exclude-from=diff.excl 0947/src/wordlists.c cvs/src/wordlists.c
--- 0947/src/wordlists.c 2005-04-24 17:34:33.000000000 -0400
+++ cvs/src/wordlists.c 2005-05-01 14:10:07.000000000 -0400
@@ -1,4 +1,4 @@
-/* $Id: wordlists.c,v 1.98 2005/04/24 21:34:33 relson Exp $ */
+/* $Id: wordlists.c,v 1.100 2005/05/01 18:10:07 relson Exp $ */
#include "common.h"
@@ -173,10 +173,11 @@
if (list != NULL) {
bfpath *bfp = list->bfp;
- const char *dir = get_directory_from_path(bfp->filepath);
+ char *dir = get_directory_from_path(bfp->filepath);
if (dir != NULL) {
check_wordlist_path(list);
set_bogohome(dir);
+ free(dir);
}
}
}
More information about the bogofilter
mailing list