Date: Sat, 14 Jan 2012 09:32:09 +0900 (JST) From: Hiroki Sato <hrs@FreeBSD.org> To: dougb@FreeBSD.org Cc: freebsd-rc@FreeBSD.org, pjd@FreeBSD.org Subject: Re: Making use of set_rcvar. Message-ID: <20120114.093209.917724318321412912.hrs@allbsd.org> In-Reply-To: <20120113141058.GE1662@garage.freebsd.pl> References: <20120109.223510.1979757999064039809.hrs@allbsd.org> <4F0FFFF7.4090105@FreeBSD.org> <20120113141058.GE1662@garage.freebsd.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart(Sat_Jan_14_09_32_09_2012_446)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Pawel Jakub Dawidek <pjd@FreeBSD.org> 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)----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120114.093209.917724318321412912.hrs>