From owner-freebsd-rc@FreeBSD.ORG Sat Jan 14 00:39:30 2012 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2115106564A; Sat, 14 Jan 2012 00:39:30 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper-int.allbsd.org [IPv6:2001:2f0:104:e002::2]) by mx1.freebsd.org (Postfix) with ESMTP id EB3918FC0C; Sat, 14 Jan 2012 00:39:29 +0000 (UTC) Received: from alph.allbsd.org ([IPv6:2001:2f0:104:e010:862b:2bff:febc:8956]) (authenticated bits=128) by mail.allbsd.org (8.14.4/8.14.4) with ESMTP id q0E0dEDv011450; Sat, 14 Jan 2012 09:39:24 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id q0E0dDj5042627; Sat, 14 Jan 2012 09:39:14 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Sat, 14 Jan 2012 09:32:09 +0900 (JST) Message-Id: <20120114.093209.917724318321412912.hrs@allbsd.org> To: dougb@FreeBSD.org From: Hiroki Sato In-Reply-To: <20120113141058.GE1662@garage.freebsd.pl> References: <20120109.223510.1979757999064039809.hrs@allbsd.org> <4F0FFFF7.4090105@FreeBSD.org> <20120113141058.GE1662@garage.freebsd.pl> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.3.51 on Emacs 23.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Sat_Jan_14_09_32_09_2012_446)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (mail.allbsd.org [IPv6:2001:2f0:104:e001::32]); Sat, 14 Jan 2012 09:39:27 +0900 (JST) X-Spam-Status: No, score=-104.6 required=13.0 tests=BAYES_00, CONTENT_TYPE_PRESENT, RDNS_NONE, SPF_SOFTFAIL, USER_IN_WHITELIST autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on gatekeeper.allbsd.org Cc: freebsd-rc@FreeBSD.org, pjd@FreeBSD.org Subject: Re: Making use of set_rcvar. X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 00:39:30 -0000 ----Security_Multipart(Sat_Jan_14_09_32_09_2012_446)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Pawel Jakub Dawidek wrote in <20120113141058.GE1662@garage.freebsd.pl>: pj> On Fri, Jan 13, 2012 at 01:57:11AM -0800, Doug Barton wrote: pj> > On 01/09/2012 05:35, Hiroki Sato wrote: pj> > > I prefer to use ${name}_enable because putting the same keyword in pj> > > two places always leads to a stupid typo issue. pj> > pj> > So, here's the thing. I understand what you're saying, I really do. The pj> > problem is, you're still wrong. :) pj> > pj> > There are MANY places where you have to use the value of $name literally pj> > already, and typos count in every single one of them: pj> > pj> > 1. The name of the script file pj> > 2. PROVIDE pj> > 3. REQUIRE pj> > 4. names of service-specific methods, e.g.: start_precmd="foo_prestart" pj> > 5. Default values in /etc/defaults/rc.conf pj> > 6. rc.conf.5 pj> > pj> > And that's just off the top of my head. The ideal of being able to pj> > copy/paste example rc.d scripts for use with new services without having pj> > to change [m]any code sounds great in theory. In practice, search and pj> > replace is an absolute necessity. So having one more place where you pj> > have to replace the name of the old service with the new one isn't going pj> > to hurt anything. pj> pj> But if we can avoid it, why not? You gave no argument (valid one) why pj> using variables is wrose than hardcoding names everywhere. pj> pj> > I haven't seen any objection to the _substance_ of my proposal, so I'm pj> > going to go ahead with it tomorrow. pj> pj> Please don't. Touching so many rc.d files is PITA during mergemaster. pj> If we want to do that, let's do that once. The current consensus as I pj> see it, is that you are the only one wanting to hardcode names and there pj> are many in favour of using variables. And I do not think it is a good idea to commit something related to this topic while the discussion is ongoing. We have reached a consensus that `set_rcvar` is expensive, but for whether using literal or variable we haven't. -- Hiroki ---------------------------- revision 1.1149 date: 2012/01/13 22:52:32; author: dougb; state: Exp; lines: +2 -2 Change rcvar in the example rc.d script to use the literal value ---------------------------- Index: book.sgml =================================================================== RCS file: /home/ncvs/doc/en_US.ISO8859-1/books/porters-handbook/book.sgml,v retrieving revision 1.1148 retrieving revision 1.1149 diff -d -u -I \$FreeBSD:.*\$ -I \$NetBSD:.*\$ -I \$OpenBSD:.*\$ -I \$DragonFly:.*\$ -I \$Id:.*\$ -I \$Translation:.*\$ -I \$hrs:.*\$ -r1.1148 -r1.1149 --- book.sgml 10 Jan 2012 03:32:58 -0000 1.1148 +++ book.sgml 13 Jan 2012 22:52:32 -0000 1.1149 @@ -8956,8 +8956,8 @@ . /etc/rc.subr -name="doormand" -rcvar=${name}_enable +name=doormand +rcvar=doormand_enable load_rc_config $name ----Security_Multipart(Sat_Jan_14_09_32_09_2012_446)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk8QzQkACgkQTyzT2CeTzy00dwCglzNykficW39wQRlzDi0Nh6M2 lb0AoIhnJ8EXRV9OPttqUIillegisEoj =L5be -----END PGP SIGNATURE----- ----Security_Multipart(Sat_Jan_14_09_32_09_2012_446)----