$BOGOFILTER_DIR has no effect, rc example: bogofilter_dir not recognized

Christian Ebert bcc at phloxic.productions
Tue Apr 22 00:57:09 CEST 2025


Hi Matthias,

* Matthias Andree via bogofilter on Monday, April 21, 2025 at 23:08:33 +0200:
> Am 21.04.25 um 13:41 schrieb Christian Ebert:
>> if [ -r /Users/chris/.bashrc ]; then
>>     # shellcheck disable=SC1091
>>     . /Users/chris/.bashrc
>> fi
>> 
>> I really don't understand what's going on.
>> 
>> Did you try $BOGOFILTER_DIR with real mail traffic or just 
>> bogofilter -QQ?
> 
> Christian,
> 
> thanks for the report.
> 
> Regarding environment variables, you are not trying to set a variable 
> whose name begins with a $ sign, are you?
> 
> You wrote  >>  export $BOGOFILTER_DIR=... <<  the day before 
> yesterday, and that won't work.

Yup, Message-ID: <aANWFlfjKKoBDUTy at krille.phloxic.productions>, 
typo, sorry. In all other places i believe I got it right, and 
would have stumbled over it in my trials.

> The variable is called BOGOFILTER_DIR without $, and in bash you don't 
> add the $ when defining or assigning to a variable. You use the $ only 
> for expansion of the variable (meaning replacing the variable name by 
> its contents) in shells such as POSIX sh, bash, ash, dash, ksh, pdksh 
> and maybe other programming languages that expose environment 
> variables via $. You haven't shown your /Users/chris/.bashrc nor your 
> /etc/bashrc. This is unlike Perl where you always prefix a "scalar" 
> variable (including string variable) with a $.

Thanks for the heads up. Unfortunately I did not make that 
mistake outside of the message. bogofilter -QQ also reports the 
location set of BOGOFILTER_DIR set in bashrc. But when I filter 
mail only a fresh ~/.bogofilter directory was created and a new 
db started:

grep -F BOGOFILTER_DIR ~/.bashrc
BOGOFILTER_DIR=${XDG_DATA_HOME}/bogofilter/bogofilter
export BOGOFILTER_DIR
$ echo $BOGOFILTER_DIR
/Users/chris/.local/share/bogofilter/bogofilter
$ bogofilter -QQ | grep -F bogofilter-dir
bogofilter-dir     = /Users/chris/.local/share/bogofilter/bogofilter
ls ~/.bogofilter
ls: /Users/chris/.bogofilter: No such file or directory
$ mail chris
Subject: test
test
.
EOT
~$ ls ~/.bogofilter/
wordlist.lmdb		wordlist.lmdb-lock

> Beyond that, I need to review the source code to see how the parsing 
> from command line, environment variables, rcfile goes, and where we 
> use - and where we use _. The bf_compact you mentioned appears to be a 
> bug.
> 
> https://gitlab.com/bogofilter/bogofilter/-/issues/15 - I intend to fix 
> this before the next release candidate (thus before release of 1.3.0).

Thanks,

Christian

-- 
phloxic.underdogma movie      _MORALISK  ANSTALT_
                                 "Nix verstanden."

🔗 https://phloxic.productions/underdogma/manstalt


More information about the bogofilter mailing list