On Mon, 09 Dec 2024 10:45:09 +0100,
Tim van der Molen <t...@kariliq.nl> wrote:
> 
> Kirill A. Korinsky (2024-12-08 21:03 +0100):
> > On Sun, 08 Dec 2024 20:40:07 +0100,
> > Tim van der Molen <t...@kariliq.nl> wrote:
> > > 
> > > Kirill A. Korinsky (2024-12-06 23:48 +0100):
> > > > ports@,
> > > > 
> > > > here a fix for mail/spampd to adjust default home directory to really 
> > > > used
> > > > one.
> > > > 
> > > > If a user installs spampd and runs it, he will discover the following 
> > > > error
> > > > for each processed email:
> > > > 
> > > >     plugin: eval failed: bayes: (in learn) locker: safe_lock: cannot 
> > > > create tmp lockfile 
> > > > /var/spool/spamassassin/spampd/bayes.lock.mx1.catap.net.47578 for 
> > > > /var/spool/spamassassin/spampd/bayes.lock: Permission denied
> > > > 
> > > > Current workaround is adding --homedir option. And if user did it, my 
> > > > fix
> > > > won't affect him.
> > > 
> > > Won't this break existing setups? I do have a home directory at
> > > /var/spool/spamassassin/spampd (but I don't remember if I had to create
> > > it manually).
> > >
> > 
> > This is as I had discovered it.
> > 
> >     ~ $ ls -l /var/spool/spamassassin 
> >     ls: /var/spool/spamassassin: No such file or directory
> >     ~ $ doas pkg_add -a spampd        
> >     quirks-7.72 signed on 2024-12-07T16:30:33Z
> >     spampd-2.61p0:p5-strictures-2.000006: ok
> >     spampd-2.61p0:p5-Class-Method-Modifiers-2.15: ok
> >     spampd-2.61p0:p5-Role-Tiny-2.002004: ok
> >     ...
> >     spampd-2.61p0:p5-BSD-Resource-1.2911p0: ok
> >     useradd: Warning: home directory `/var/db/spamassassin' doesn't exist, 
> > and -m was not specified
> >     spampd-2.61p0:p5-Mail-SpamAssassin-4.0.1: ok
> >     useradd: Warning: home directory `/var/spampd' doesn't exist, and -m 
> > was not specified
> >     spampd-2.61p0: ok
> >     The following new rcscripts were installed: /etc/rc.d/spamassassin 
> > /etc/rc.d/spampd
> >     See rcctl(8) for details.
> >     New and changed readme(s):
> >             /usr/local/share/doc/pkg-readmes/p5-Mail-SpamAssassin
> >             /usr/local/share/doc/pkg-readmes/p5-XML-LibXML
> >     ~ $ ls -l /var/spool/spamassassin 
> >     ls: /var/spool/spamassassin: No such file or directory
> >     ~ $ doas rcctl start spampd       
> >     spampd(ok)
> >     ~ $ doas find /var/spool/spamassassin | doas xargs stat
> >     1044 3240875 drwx------ 3 root wheel 12967514 512 "Dec  8 20:56:36 
> > 2024" "Dec  8 20:56:36 2024" "Dec  8 20:56:36 2024" 16384 4 0 
> > /var/spool/spamassassin
> >     1044 3241226 drwx------ 3 root wheel 12967865 512 "Dec  8 20:56:36 
> > 2024" "Dec  8 20:56:36 2024" "Dec  8 20:56:36 2024" 16384 4 0 
> > /var/spool/spamassassin/spampd
> >     1044 3241227 drwx------ 2 root wheel 12967866 512 "Dec  8 20:56:36 
> > 2024" "Dec  8 20:56:36 2024" "Dec  8 20:56:36 2024" 16384 4 0 
> > /var/spool/spamassassin/spampd/.spamassassin
> >     ~ $
> > 
> > When I install it on clean system it creates /var/spampd for _spampd user,
> > and on the first start it creats folders which is own by root:wheel
> > 
> > It complains because spampd is running under _spampd and can't create lock
> > nor other bayes files.
> > 
> > Port after installing somehow broken, and I think what it needs to be fixed.
> 
> Perhaps the port should create /var/spool/spamassassin/spampd with
> appropriate permissions?
>

Probably, but you won't be able to use doas -u _spampd sa-learn to train
your base without bayes_path /var/spool/spamassassin/spampd/bayes

Also, plist contains:

  @extraunexec rm -rf /var/spampd/.spamassassin

that lead me to conclusion that this is the place where DB should be stored.

> > Also, during some testing I had discovered that it writes some bayes relates
> > files into /var/spampd, and sometimes the same files into 
> > /var/spampd/.spamassassin
> > 
> > May I ask you to check content of your /var/spool/spamassassin via find? 
> 
> $ doas find /var/spampd /var/spool/spamassassin ! -type d | sort
> /var/spampd/spampd.pid
> /var/spool/spamassassin/spampd/bayes_journal
> /var/spool/spamassassin/spampd/bayes_seen
> /var/spool/spamassassin/spampd/bayes_toks
> 

May I ask about the size of this files and permissions?

I'm asking because my DB was quite often corrupted and had size larger than
disk (a few TB). So, at the end I motivated myself to move to redis and it
help me to discover and fix a bug in spampd which, probably, was a root
cause why I had switched to redis, see: 
https://github.com/mpaperno/spampd/pull/45

-- 
wbr, Kirill

Reply via email to