$BOGOFILTER_DIR has no effect, rc example: bogofilter_dir not recognized
Matthias Andree
matthias.andree at gmx.de
Tue Apr 22 01:12:20 CEST 2025
Am 22.04.25 um 00:57 schrieb Christian Ebert:
> 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
Unless MacOS does Stupid Things™, the mail *delivery* runs through a
different user account (some system account) and environment, and that
system user will not heed your user's (chris's) local settings and also
likely not use bash as a shell (if any at all).
You need to check what your mail transfer agent is, how exactly it
invokes bogofilter and how that (system) user account is configured. I
don't know MacOS, so I have no idea how it delivers mail.
More information about the bogofilter
mailing list