Your patch looks good Stuart. It definitely fixes the spamlogd
pre-check.

On Sun, 3 Apr 2022 12:08:06 +0100
Stuart Henderson <s...@spacehopper.org> wrote:

> On 2022/04/03 01:50, Clint Pachl wrote:
> > Setting aside pflog, I still think there may have been an error
> > introduced in revision 1.2, as I stated in my bug description below.
> > 
> > Unless "rc_pre" works in a way that I don't understand, the first
> > line of the rc_pre function in rc.d/spamlogd is an error; it's an
> > unchecked condition.  
> 
> Hmm, I wonder if this code used to run with "set -e" (which does work
> as expected with the unchecked condition).

I initially thought so too, but it doesn't seem to be the case. I
couldn't find any setting of errexit in rc.subr going back 9+ years.

It seems this error was introduced in rc.d/spamlogd revision 1.2 when
the pf/pflog stuff was added to the pre-check function.


> > Here's a patch to explain:  
> 
> alternatively, avoiding extending the laddered if:
> 
> Index: spamlogd
> ===================================================================
> RCS file: /cvs/src/etc/rc.d/spamlogd,v
> retrieving revision 1.4
> diff -u -p -r1.4 spamlogd
> --- spamlogd  11 Jan 2018 21:09:26 -0000      1.4
> +++ spamlogd  3 Apr 2022 11:05:21 -0000
> @@ -9,7 +9,7 @@ daemon="/usr/libexec/spamlogd"
>  rc_reload=NO
>  
>  rc_pre() {
> -     [[ ${spamd_flags} != NO && ${spamd_black} == NO ]]
> +     [[ ${spamd_flags} != NO && ${spamd_black} == NO ]] && return
> 1 if pfctl -si | grep -q Enabled; then
>               ifconfig pflog0 create
>               if ifconfig pflog0; then
> 

Reply via email to