From owner-freebsd-ports@FreeBSD.ORG Tue Jun 3 17:03:44 2008 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A2AD106566B for ; Tue, 3 Jun 2008 17:03:44 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx24.fluidhosting.com [204.14.89.7]) by mx1.freebsd.org (Postfix) with ESMTP id 2B1D08FC13 for ; Tue, 3 Jun 2008 17:03:44 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: (qmail 29741 invoked by uid 399); 3 Jun 2008 17:16:46 -0000 Received: from localhost (HELO lap.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 3 Jun 2008 17:16:46 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4845796C.1080505@FreeBSD.org> Date: Tue, 03 Jun 2008 10:03:40 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.14 (X11/20080525) MIME-Version: 1.0 To: Paul Schmehl References: <765B879956FB90DA571FA609@Macintosh.local> <20080603131937.192622ee@gumby.homeunix.com.> In-Reply-To: X-Enigmail-Version: 0.95.6 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Robert Watson , freebsd-ports@freebsd.org Subject: Re: Problems with startup scripts X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jun 2008 17:03:44 -0000 Paul Schmehl wrote: > --On Tuesday, June 03, 2008 13:19:37 +0100 RW > wrote: > >> On Mon, 02 Jun 2008 22:13:15 -0500 >> Paul Schmehl wrote: >> >> >>> Imagine my surprise when I discovered that *all* of my startup >>> scripts=20 were running double flags! >>> >>> So, I looked at /etc/rc.subr, and lo and behold: >>> Line 670 of /etc/rc.subr has "$command $rc_flags $command_args" >>> >>> So, the question is, is this an error in rc_subr? No, it's always been that way, and it's actually fairly well documented. >> There are a number of /etc/rc.d scripts that follow similar usage, but >> they are mostly using flag variable names that don't match >> "${name}_flags". The exception is auditd which presumably would >> get double flags, if it were actually given any. That usage in auditd appears to be an error. >> $ grep -Ei "command_args.*=.*flags" /etc/rc.d/* >> /etc/rc.d/auditd:command_args="${auditd_flags}" >> /etc/rc.d/nfsd:command_args="${nfs_server_flags}" >> /etc/rc.d/ypbind:command_args="${nis_client_flags}" >> /etc/rc.d/yppasswdd:command_args="${nis_yppasswdd_flags}" >> /etc/rc.d/ypserv:command_args="${nis_server_flags}" >> /etc/rc.d/ypset:command_args="${nis_ypset_flags}" >> /etc/rc.d/ypxfrd:command_args="${nis_ypxfrd_flags}" > > I'm willing to bet that if you run some of these scripts through sh -x > (auditd, for example) you will find that they use double flags, just > like mine do. That would be true for auditd, but not for the others, for the reason described above. > Since rc.subr will append the flags to the commandline, adding them to > command_args is superfluous. If you set flags defaults in the script > such that /etc/rc.conf settings will override them, there's no need to > add flags to the commandline. Rc.subr does it for you. That's right. I try to catch these when scripts are committed or modified, but I can't review them all. Glad to hear that you got the right education though, and hopefully this being on the ports list will help someone else too. Doug -- This .signature sanitized for your protection