[PATCH] bogoutil paths [was: bogofilter-0.94.9 - new current release]
David Relson
relson at osagesoftware.com
Sat May 7 01:20:51 CEST 2005
On Fri, 6 May 2005 09:55:39 -0300
Andreas Hasenack wrote:
> On Fri, May 06, 2005 at 06:53:54AM -0400, David Relson wrote:
> > Greetings,
> >
> > This release fixes a bogofilter_dir precedence regression. Using the
> > command line option "-d correct" once again overrides the config file
> > option "bogofilter_dir=incorrect".
>
> I'm getting a failed test with this release:
> (...)
> PASS: t.maildir
> Can't open wordlist '/home/andreas/.bogofilter/wordlist.db'
> find: ./checks.16753.20050506T094605: No such file or directory
> FAIL: t.bogoutil
> (...)
>
> This test used to pass with 0.94.7 on the same system. Something wrong on my end?
Andreas,
AFAICT, the attached patch fixes the pathing problem in bogoutil. Give
it a try and let me know how it works for you.
David
-------------- next part --------------
diff -u -r --exclude-from=diff.excl 0949/src/bogoutil.c cvs/src/bogoutil.c
--- 0949/src/bogoutil.c 2005-05-05 21:23:41.000000000 -0400
+++ cvs/src/bogoutil.c 2005-05-06 18:14:09.000000000 -0400
@@ -1,4 +1,4 @@
-/* $Id: bogoutil.c,v 1.219 2005/05/06 01:23:41 relson Exp $ */
+/* $Id: bogoutil.c,v 1.220 2005/05/06 22:14:09 relson Exp $ */
/*****************************************************************************
@@ -833,8 +833,6 @@
set_today(); /* compute current date for token age */
- set_bogohome( "." ); /* set default */
-
process_arglist(argc, argv);
process_config_files(false, longopts_bogoutil); /* need to read lock sizes */
@@ -846,6 +844,9 @@
}
bfp = bfpath_create(ds_file);
+ if (bogohome == NULL)
+ set_bogohome( "." ); /* set default */
+
bfpath_set_bogohome(bfp);
mode = get_mode(flag);
diff -u -r --exclude-from=diff.excl 0949/src/paths.c cvs/src/paths.c
--- 0949/src/paths.c 2005-05-05 21:35:35.000000000 -0400
+++ cvs/src/paths.c 2005-05-06 18:13:59.000000000 -0400
@@ -1,4 +1,4 @@
-/* $Id: paths.c,v 1.48 2005/05/06 01:35:35 relson Exp $ */
+/* $Id: paths.c,v 1.49 2005/05/06 22:13:59 relson Exp $ */
/**
* \file
@@ -43,13 +43,20 @@
void set_bogohome(const char *path)
{
xfree(bogohome);
- bogohome = (path == NULL) ? NULL : xstrdup(path);
+ bogohome = xstrdup(path);
}
-static bool check_bogohome(void)
+static bool cant_find_bogohome(void)
{
- return (set_wordlist_dir(NULL, PR_ENV_BOGO) == 0 ||
- set_wordlist_dir(NULL, PR_ENV_HOME) == 0);
+ if (bogohome != NULL)
+ return false;
+
+ if (set_wordlist_dir(NULL, PR_ENV_BOGO) == 0)
+ return false;
+ if (set_wordlist_dir(NULL, PR_ENV_HOME) == 0)
+ return false;
+
+ return true;
}
void bogohome_cleanup(void)
@@ -213,9 +220,8 @@
void bfpath_set_bogohome(bfpath *bfp)
{
- /* bogohome should be set by now */
-
- if (!check_bogohome()) {
+ /* ensure bogohome is set */
+ if (cant_find_bogohome()) {
fprintf(stderr, "Can't find HOME or BOGOFILTER_DIR in environment.\n");
exit(EX_ERROR);
}
diff -u -r --exclude-from=diff.excl 0949/src/paths.h cvs/src/paths.h
--- 0949/src/paths.h 2005-05-05 21:34:01.000000000 -0400
+++ cvs/src/paths.h 2005-05-06 18:08:58.000000000 -0400
@@ -1,4 +1,4 @@
-/* $Id: paths.h,v 1.27 2005/05/06 01:34:01 relson Exp $ */
+/* $Id: paths.h,v 1.28 2005/05/06 22:08:58 relson Exp $ */
/**
* \file
@@ -46,9 +46,7 @@
bfpath *bfpath_create(const char *path);
void bfpath_set_bogohome(bfpath *bfp);
-bfpath *bfpath_initialize(bfpath *bfp, bfpath_mode mode);
bool bfpath_check_mode(bfpath *bfp, bfpath_mode mode);
-bfpath *bfpath_fixup(bfpath *path);
bfpath *bfpath_free(bfpath *path);
bool paths_equal(bfpath *p1, bfpath *p2);
More information about the bogofilter
mailing list