NetBSD Problem Report #18928
Received: (qmail 28023 invoked by uid 605); 4 Nov 2002 18:08:44 -0000
Message-Id: <20021104180819.0D75B1326C@moltar.savecore.net>
Date: Mon, 4 Nov 2002 10:08:19 -0800 (PST)
From: fcusack@fcusack.com
Sender: gnats-bugs-owner@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: /etc/rc.d/spamd can never start at boot
X-Send-Pr-Version: 3.95
>Number: 18928
>Category: pkg
>Synopsis: /etc/rc.d/spamd can never start at boot
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: heinz
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 04 18:09:01 +0000 2002
>Closed-Date: Sat Nov 09 13:17:50 +0000 2002
>Last-Modified: Sat Apr 29 08:53:24 +0000 2006
>Originator: Frank Cusack
>Release: NetBSD 1.6
>Organization:
>Environment:
System: NetBSD moltar.savecore.net 1.6 NetBSD 1.6 (moltar) #6: Mon Oct 7 01:03:19 PDT 2002 root@moltar.savecore.com:/usr/src/sys/arch/sparc64/compile/moltar sparc64
Architecture: sparc64
Machine: sparc64
>Description:
[ package SpamAssassin ]
/etc/rc.d/spamd sets defaults for $spamd and $spamd_flags, and
claims (in a comment) that these can be overridden in /etc/rc.conf.
However, they cannot. load_rc_config(), at the bottom of the
script, does NOT re-load rc.conf at boot time, because
$_rc_conf_loaded is already set. The effect is that the values
in the spamd script are always the values used. Probably not
caught because when run by hand, $_rc_conf_loaded is not set,
and so the script appears to work.
>How-To-Repeat:
>Fix:
Two options:
1) move the spamd default settings to /etc/defaults/rc.conf.
2) unset $_rc_conf_loaded before calling load_rc_config().
The first option seems better.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->heinz
Responsible-Changed-By: heinz
Responsible-Changed-When: Mon Nov 4 12:23:10 PST 2002
Responsible-Changed-Why:
Package maintainer will take care of this one.
State-Changed-From-To: open->feedback
State-Changed-By: heinz
State-Changed-When: Mon Nov 4 17:43:31 PST 2002
State-Changed-Why:
A fix was provided to the submitter
From: Klaus Heinz <k.heinz.nov.zwei@onlinehome.de>
To: fcusack@fcusack.com
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/18928: /etc/rc.d/spamd can never start at boot
Date: Tue, 5 Nov 2002 02:41:58 +0100
Hi,
your analysis is correct. The check for $_rc_conf_loaded is a new
feature of NetBSD 1.6. I did test the rc.d script on a machine with
1.6 although only manually.
As /etc/defaults/rc.conf comes with the base system I would not like it
to be cluttered with default values for packages from pkgsrc.
Could you try the following instead of the existing variable assignments
in /etc/rc.d/spamd? Don't forget the colons.
-spamd_flags="-H -c -a"
-spamd=NO
+: ${spamd_flags="-H -c -a"}
+: ${spamd:=NO}
This way, the script does not override variables from rc.conf if there
are any.
ciao
Klaus
From: Klaus Heinz <k.heinz.nov.zwei@onlinehome.de>
To: Frank Cusack <fcusack@fcusack.com>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/18928: /etc/rc.d/spamd can never start at boot
Date: Tue, 5 Nov 2002 22:43:08 +0100
Hi Frank,
[ I have included Cc: gnats-bugs@netbsd.org to have this conversation
recorded in our bug database ]
I have to disagree with your proposal. Your solution expands to the
commands '-H -c -a' and 'NO' respectively, which will fail.
If you look closely at the man page for sh(1), you will see that
although ':' is the 'null' command, the shell performs parameter
expansion before looking for the command it is supposed to execute.
Thus, the assignments will be done and _then_ the null command will be
executed, returning 0, and the result of the parameter expansion (eg
'-H -c -a') will be discarded.
To be honest, this trick was suggested by Luke Mewburn and I didn't know
it before :-), but it is valid shell syntax.
A different way to achieve the same goal would be this:
spamd_flags=${spamd_flags-"-H -c -a"}
spamd=${spamd:-NO}
Here, the assignment is not a side effect but the whole purpose of those
lines. Looking at this, it appears to convey more clearly what is
intended.
ciao
Klaus
From: Frank Cusack <fcusack@fcusack.com>
To: Klaus Heinz <k.heinz.nov.zwei@onlinehome.de>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/18928: /etc/rc.d/spamd can never start at boot
Date: Tue, 5 Nov 2002 20:46:29 -0800
On Tue, Nov 05, 2002 at 10:43:08PM +0100, Klaus Heinz wrote:
> Hi Frank,
>
> [ I have included Cc: gnats-bugs@netbsd.org to have this conversation
> recorded in our bug database ]
Yeah, I see now that gnats wants to be in threads. :-)
> I have to disagree with your proposal. Your solution expands to the
> commands '-H -c -a' and 'NO' respectively, which will fail.
>
> If you look closely at the man page for sh(1), you will see that
> although ':' is the 'null' command, the shell performs parameter
> expansion before looking for the command it is supposed to execute.
Yeah, I missed that you weren't doing an a=b assignment and just figured
':' meant nothing. I've never seen
: ${foo:=bar}
and was just confused. I should have actually tested it. :-)
> A different way to achieve the same goal would be this:
> spamd_flags=${spamd_flags-"-H -c -a"}
> spamd=${spamd:-NO}
>
> Here, the assignment is not a side effect but the whole purpose of those
> lines. Looking at this, it appears to convey more clearly what is
> intended.
Which is the change I meant when I emailed you (directly). So the
question is, is the compactness of the ':' version worth the obscurity?
I leave that to you. I think it's not so bad, unlike similar perl-isms.
I'll certainly be using it in my own shell code. :-)
My suggestion of patch was also incorrect in the setting of $spamd_flags,
which you got correct.
Thanks
/fc
From: Klaus Heinz <heinz@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:
Subject: pr/18928 CVS commit: pkgsrc/mail/spamassassin
Date: Wed, 6 Nov 2002 23:51:27 +0200 (EET)
Module Name: pkgsrc
Committed By: heinz
Date: Wed Nov 6 21:51:27 UTC 2002
Modified Files:
pkgsrc/mail/spamassassin: Makefile distinfo
pkgsrc/mail/spamassassin/patches: patch-ad patch-ag patch-ah
Log Message:
Changed the rc.d script to account for different behaviour of
load_rc_config in NetBSD 1.6. This resolves PR pkg/18928 by Frank Cusack
(fcusack at fcusack com).
The rc.d script is now called on 'shutdown'.
Included fixes from SA CVS repository (2002-10-21) to minimize
impact of Razor2 on the environment vector, especially PATH.
Bumped PKGREVISION.
To generate a diff of this commit:
cvs rdiff -r1.13 -r1.14 pkgsrc/mail/spamassassin/Makefile
cvs rdiff -r1.8 -r1.9 pkgsrc/mail/spamassassin/distinfo
cvs rdiff -r1.2 -r1.3 pkgsrc/mail/spamassassin/patches/patch-ad
cvs rdiff -r1.1 -r1.2 pkgsrc/mail/spamassassin/patches/patch-ag \
pkgsrc/mail/spamassassin/patches/patch-ah
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Klaus Heinz <k.heinz.nov.zwei@onlinehome.de>
To: Frank Cusack <fcusack@fcusack.com>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/18928: /etc/rc.d/spamd can never start at boot
Date: Wed, 6 Nov 2002 23:52:19 +0100
Frank Cusack wrote:
> question is, is the compactness of the ':' version worth the obscurity?
I have chosen the explicit assignment, for clarity. If cou can confirm
that the bug is now gone (it should be :), I will close this PR.
ciao
Klaus
From: Frank Cusack <fcusack@fcusack.com>
To: Klaus Heinz <k.heinz.nov.zwei@onlinehome.de>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/18928: /etc/rc.d/spamd can never start at boot
Date: Fri, 8 Nov 2002 04:09:04 -0800
On Wed, Nov 06, 2002 at 11:52:19PM +0100, Klaus Heinz wrote:
> I have chosen the explicit assignment, for clarity. If cou can confirm
> that the bug is now gone (it should be :), I will close this PR.
Your patch works. Thanks for your patience.
/fc
State-Changed-From-To: feedback->closed
State-Changed-By: heinz
State-Changed-When: Sat Nov 9 05:16:07 PST 2002
State-Changed-Why:
Problem solved
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.