From owner-freebsd-rc@FreeBSD.ORG Mon Oct 15 18:30:02 2012 Return-Path: Delivered-To: freebsd-rc@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 123AF5F6 for ; Mon, 15 Oct 2012 18:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [8.8.178.135]) by mx1.freebsd.org (Postfix) with ESMTP id E49FA8FC08 for ; Mon, 15 Oct 2012 18:30:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q9FIU13V045112 for ; Mon, 15 Oct 2012 18:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q9FIU11n045109; Mon, 15 Oct 2012 18:30:01 GMT (envelope-from gnats) Date: Mon, 15 Oct 2012 18:30:01 GMT Message-Id: <201210151830.q9FIU11n045109@freefall.freebsd.org> To: freebsd-rc@FreeBSD.org Cc: From: Chris Rees Subject: Re: docs/172692: [PATCH] Bring parts of the rc scripting guides up to date X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Chris Rees 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: Mon, 15 Oct 2012 18:30:02 -0000 The following reply was made to PR docs/172692; it has been noted by GNATS. From: Chris Rees To: Michael Telahun Makonnen Cc: freebsd-doc@freebsd.org, freebsd-rc@freebsd.org, freebsd-bugs@freebsd.org, "bug-followup@freebsd.org" Subject: Re: docs/172692: [PATCH] Bring parts of the rc scripting guides up to date Date: Mon, 15 Oct 2012 19:26:22 +0100 On 15/10/2012, Michael Telahun Makonnen wrote: > Some minor nits: > > - have the same prefix: ${name}. For > + have the same prefix: ${name}_. For > > You should add the same correction to the very next sentence, which reads: > > Note: While it is possible to use a shorter name internally, e.g., just Done, thanks! > > > @@ -491,15 +491,6 @@ > our script will save us from possible > collisions with the &man.rc.subr.8; namespace. > > - As long as an &man.rc.conf.5; variable and its > - internal equivalent are the same, we can use a more > - compact expression to set the default value: > - > - : ${dummy_msg:="Nothing > started."} > - > - The current style is to use the more verbose form > - though. > - > > Not sure why you felt this paragraph needed to be removed. Because the style is clearer and makes it much more obvious when a variable is having its own default value set. In ports at least, the current style is to use the less verbose form. > @@ -512,7 +503,11 @@ > > > Here we use dummy_msg to actually > - control our script, i.e., to emit a variable message. > + control our script, i.e., to emit a variable message. > + Use of a shell function is overkill here, since it only > + runs a single command; an equally valid alternative is: > + > + start_cmd="echo \"$dummy_msg\"" > > While you are technically correct, I think you misunderstood the > writer's intent, which was to show how an rc.conf(8) variable can be > used in a subroutine to control the behavior of the command. I agree > that the example isn't a very good one (in that it doesn't depict a > valid use case), but I think the "spirit" is correct. Maybe you can > suggest a better example? > I think that this script is very simple by design, and making a better example would complicate it. It is definitely worth pointing out the alternative though; it makes useful food for thought; both examples with a disclaimer. Thank you very much for commenting, and I feel bad that I'm fobbing you off. You've raised genuine points, but I had already considered them. Please keep on at me if you think I still need to do something about it. Chris [1] http://www.bayofrum.net/~crees/patches/rc-scripting-modernise2.diff -- Chris Rees | FreeBSD Developer crees@FreeBSD.org | http://people.freebsd.org/~crees