[PATCH] to fix "-d" and "--bogofilter_dir=directory" [was: Bug#231047: Stopped tilde-expanding bogofilter_dir config file setting ]

David Relson relson at osagesoftware.com
Thu Feb 5 02:22:05 CET 2004


On Wed, 4 Feb 2004 09:01:58 -0500
Clint Adams wrote:

> > Bogofilter 0.17.0 has stopped tilde-expanding the bogofilter_dir
> > setting in the config file:

...[snip]...

> > It worked in 0.16.4. As far as I can tell, the culprit is the new
> > option-processing code in bogoconfig.c, which initialized
> > long_options to, among other things:
> > 
> >     { "bogofilter_dir",                 N, 0, 'd' },
> > ...
> >     { "bogofilter_dir",                 R, 0, O_BOGOFILTER_DIR },
> > 
> > The first of these should probably have had a dash instead of an
> > underscore; it leads to code that assumes that the value has been
> > passed on the command line (where the shell may be assumed to have
> > done its own tilde expansion).
> > 
> > At least, changing it to a dash fixes the problem for me.

Yep.  It's broken in 0.17.0 :-(

The proper line for "bogofilter_dir" is

     { "bogofilter_dir",                 R, 0, 'd' },

However, the code for "case 'd':" and "case O_BOGOFILTER_DIR" should be
merged and function set_bogofilter_dir() should be called.

Here's the patch:

Index: bogoconfig.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogoconfig.c,v
retrieving revision 1.154
diff -u -r1.154 bogoconfig.c
--- bogoconfig.c	1 Feb 2004 01:47:12 -0000	1.154
+++ bogoconfig.c	5 Feb 2004 01:14:36 -0000
@@ -106,7 +106,7 @@
     { "report-unsure",			N, 0, 'U' },
     { "version",			N, 0, 'V' },
     { "classify-stdin",			N, 0, 'b' },
-    { "bogofilter_dir",			N, 0, 'd' },
+    { "bogofilter_dir",			R, 0, 'd' },
     { "ham",				N, 0, 'e' },
     { "help",				N, 0, 'h' },
     { "db_cachesize",			N, 0, 'k' },
@@ -127,7 +127,6 @@
     { "query",				N, 0, 'Q' },
     { "verbosity",			N, 0, 'v' },
     { "block_on_subnets",		R, 0, O_BLOCK_ON_SUBNETS },
-    { "bogofilter_dir",			R, 0, O_BOGOFILTER_DIR },
     { "charset_default",		R, 0, O_CHARSET_DEFAULT },
     { "ham_cutoff",			R, 0, O_HAM_CUTOFF },
     { "header_format",			R, 0, O_HEADER_FORMAT },
@@ -645,15 +644,9 @@
 	    process_config_option(val, true, precedence);
 	break;
 
-    case O_BOGOFILTER_DIR:
-	set_bogofilter_dir(name, val, precedence);
-	break;
-
     case 'd':
-	if (pass != PASS_1_CLI) {
-	    if (setup_wordlists(val, precedence) != 0)
-		exit(EX_ERROR);
-	}
+	if (pass != PASS_1_CLI)
+	    set_bogofilter_dir(WORDLIST, val, precedence);
 	break;
 
     case 'H':




More information about the Bogofilter mailing list