# Spamassassin Bayes error [SOLVED]

## epig

Hi all, 

After upgrading spamassassin fo v. 3.4.5 last week, I noticed a significan drop in spam caught. 

Altough I didn't touch local.cf (that has worked fine for years) and the file looks exactly the same as before, it would seem that the update has broken the config... 

 *Quote:*   

> 
> 
> grond ~ # spamassassin --lint
> 
> Jul  5 13:38:36.201 [29329] warn: config: found endif without matching conditional
> ...

 

local.cf: 

```

required_score 6.0

use_bayes 1

bayes_auto_learn 1

ifplugin Mail::SpamAssassin::Plugin::Shortcircuit

shortcircuit USER_IN_BLACKLIST on

shortcircuit USER_IN_BLACKLIST_TO on

shortcircuit SUBJECT_IN_BLACKLIST on

endif # Mail::SpamAssassin::Plugin::Shortcircuit

include /etc/spamassassin/my_black_list.cf

 shortcircuit USER_IN_WHITELIST       on

 shortcircuit USER_IN_DEF_WHITELIST   on

 shortcircuit USER_IN_ALL_SPAM_TO     on

 shortcircuit SUBJECT_IN_WHITELIST    on

include /etc/spamassassin/my_white_list.cf

score BAYES_50 2.0

score BAYES_60 2.5

score BAYES_80 5.0

score BAYES_95 5.5

score BAYES_99 6.0

score BAYES_999 2.0

score RP_MATCHES_RCVD -1.0

endif  #Mail::SpamAssassin::Plugin::Shortcircuit

```

I am at a loss here, any tips or suggsetions? (I tried to post up the lint test output, but the forums don't seem to like that)Last edited by epig on Tue Jul 06, 2021 9:14 am; edited 1 time in total

----------

## figueroa

I found this happening on July 2, but I'm not sure when the problem started. I read a bunch of logs, searched on the web and followed other bread crumbs that lead me to add USE=berkdb back to dev-lang/perl in /etc/portage/package.use.

Finally, I emerged virtual/perl-DB_File manually and re-emerged dev-db/sqlite, dev-lang/perl, and mail-filter/spamassassin, then restart spamd. That got Bayes working again.

When re-emerging sqlite and perl, I was careful not to add them to my world file. virtual/perl-DB_File  was needed to be added to world or it would be depcleaned. I was thinking then that the ebuild for spamassassin or one of it's dependencies is missing a dependency, but perl-DB_File was needed to get Bayesian filter working.

Very likely what would have fixed this would have been to have USE=berkdb added for mail-filter/spamassassin in /etc/portage/package.use. That makes virtual/perl-DB_File a dependency of spamassassin. Who could have known? So, maybe USE=berkdb isn't needed for dev-lang/perl. I don't know yet. I will experiment further tomorrow. At the moment, Bayes is still working.   :Smile: 

ADDED: I may have caused the original problem by using --changed-use rather than --newuse when updating. That would have caused me to miss as an important use change. I may have to reform my slovenly ways -- tomorrow.

----------

## epig

Thank you for  a thorough answer. 

I added berkdb to the use flags for 

dev-lang/perl

mail-filter/spamassassin

emerged

virtual/perl-DB_File

dev-db/sqlite

dev-lang/perl (Actually this one re-emerged automatically with perl-DB-file, probably due to the USE change)

mail-filter/spamassassin

Since I use amavisd-new, I threw that one in for good measure. 

But no go, still the same result: 

```

grond ~ # spamassassin --lint

Jul  6 08:46:17.023 [9290] warn: config: found endif without matching conditional

Jul  6 08:46:17.750 [9290] warn: lint: 1 issues detected, please rerun with debug enabled for more information

```

I did, however, notice this from the amavis startup: 

```

Jul 06 08:45:44 [amavis] SA info: config: found endif without matching conditional

Jul 06 08:45:45 [amavis] SpamAssassin loaded plugins: AskDNS, AutoLearnThreshold, Bayes, BodyEval, Check, DKIM, DNSEval, FreeMail, HTMLEval, HTTPSMismatch, HeaderEval, ImageInfo, MIMEEval, MIMEHeader, Pyzor, Razor2, RelayEval, ReplaceTags, Shortcircuit, SpamCop, URIDetail, URIEval, VBounce, WLBLEval, WhiteListSubject

Jul 06 08:45:45 [amavis] SpamControl: init_pre_fork on SpamAssassin done

Jul 06 08:45:45 [amavis] extra modules loaded after daemonizing/chrooting: /usr/lib64/perl5/vendor_perl/5.32/x86_64-linux/auto/Net/SSLeay/autosplit.ix, /usr/lib64/perl5/vendor_perl/5.32/x86_64-linux/auto/Net/SSLeay/randomize.al, IO/Socket/SSL.pm, IO/Socket/SSL/PublicSuffix.pm, Mail/SpamAssassin/Plugin/FreeMail.pm, Mail/SpamAssassin/Plugin/SpamCop.pm, Net/Cmd.pm, Net/Config.pm, Net/SMTP.pm, Net/SSLeay.pm

```

So, while the error is here to, the plugins seem to load just fine... 

EDIT: 

I oved my /etc/mail/spamassassin directory to a "safe" location, re-emerged spamassassin and put my black and whilelist files back. 

That seems to have fixed the problem, or at least now the lint test comes back clean. 

I will watch and report back.

----------

## freke

```
required_score 6.0

use_bayes 1

bayes_auto_learn 1

ifplugin Mail::SpamAssassin::Plugin::Shortcircuit

shortcircuit USER_IN_BLACKLIST on

shortcircuit USER_IN_BLACKLIST_TO on

shortcircuit SUBJECT_IN_BLACKLIST on

endif # Mail::SpamAssassin::Plugin::Shortcircuit

include /etc/spamassassin/my_black_list.cf

 shortcircuit USER_IN_WHITELIST       on

 shortcircuit USER_IN_DEF_WHITELIST   on

 shortcircuit USER_IN_ALL_SPAM_TO     on

 shortcircuit SUBJECT_IN_WHITELIST    on

include /etc/spamassassin/my_white_list.cf

score BAYES_50 2.0

score BAYES_60 2.5

score BAYES_80 5.0

score BAYES_95 5.5

score BAYES_99 6.0

score BAYES_999 2.0

score RP_MATCHES_RCVD -1.0

endif  #Mail::SpamAssassin::Plugin::Shortcircuit
```

You have 2x 

```
endif  #Mail::SpamAssassin::Plugin::Shortcircuit
```

But only one

```
ifplugin Mail::SpamAssassin::Plugin::Shortcircuit
```

Fixing that should get rid of the warning - I don't suspect it'll change amount of spam caught though.

----------

## epig

Simple as that. 

Thank you.

----------

## epig

It took a few attempts, but here is how my local.cf looks now, and it seems to work: 

(relevant parts of file)

```

ifplugin Mail::SpamAssassin::Plugin::Shortcircuit

shortcircuit USER_IN_BLACKLIST on

shortcircuit USER_IN_BLACKLIST_TO on

shortcircuit SUBJECT_IN_BLACKLIST on

endif 

include /etc/spamassassin/my_black_list.cf

ifplugin Mail::SpamAssassin::Plugin::Shortcircuit

shortcircuit USER_IN_WHITELIST       on

 shortcircuit USER_IN_DEF_WHITELIST   on

 shortcircuit USER_IN_ALL_SPAM_TO     on

 shortcircuit SUBJECT_IN_WHITELIST    on

endif

score BAYES_50 2.0

score BAYES_60 2.5

score BAYES_80 5.0

score BAYES_95 5.5

score BAYES_99 6.0

score BAYES_999 2.0

score RP_MATCHES_RCVD -1.0

```

now the lint test comes back clean, and bayes filtering is back. 

Marking this as solved, thank you to those who helped.

----------

## freke

Nice that it works - it still hurts my eyes though, why not put all the shortcircuit-stuff into one if..endif  :Wink: 

----------

## epig

 *freke wrote:*   

> Nice that it works - it still hurts my eyes though, why not put all the shortcircuit-stuff into one if..endif 

 

Was my thought at well, but for some reason I don't understand, this is the only working way I managed to come up with...

----------

## figueroa

Consider doing this:

```
include /etc/spamassassin/my_black_list.cf

ifplugin Mail::SpamAssassin::Plugin::Shortcircuit

shortcircuit USER_IN_BLACKLIST on

shortcircuit USER_IN_BLACKLIST_TO on

shortcircuit SUBJECT_IN_BLACKLIST on

shortcircuit USER_IN_WHITELIST       on

shortcircuit USER_IN_DEF_WHITELIST   on

shortcircuit USER_IN_ALL_SPAM_TO     on

shortcircuit SUBJECT_IN_WHITELIST    on

endif
```

It's cleaner and will be marginally faster.

----------

## epig

Stupid question: Can I use the my_black_list.cf for whitelisting?

----------

## figueroa

 *epig wrote:*   

> Stupid question: Can I use the my_black_list.cf for whitelisting?

 

To the best of my knowledge, yes.

----------

