From owner-freebsd-rc@FreeBSD.ORG  Thu Jun  1 17:41:21 2006
Return-Path: <owner-freebsd-rc@FreeBSD.ORG>
X-Original-To: freebsd-rc@FreeBSD.org
Delivered-To: freebsd-rc@FreeBSD.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7BE9216A5AC
	for <freebsd-rc@FreeBSD.org>; Thu,  1 Jun 2006 17:41:21 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.FreeBSD.org (Postfix) with SMTP id 4B94943D5A
	for <freebsd-rc@FreeBSD.org>; Thu,  1 Jun 2006 17:41:19 +0000 (GMT)
	(envelope-from dougb@FreeBSD.org)
Received: (qmail 6338 invoked by uid 399); 1 Jun 2006 17:41:18 -0000
Received: from localhost (HELO ?192.168.0.3?) (dougb@dougbarton.us@127.0.0.1)
	by localhost with SMTP; 1 Jun 2006 17:41:18 -0000
Message-ID: <447F26B9.3030601@FreeBSD.org>
Date: Thu, 01 Jun 2006 10:41:13 -0700
From: Doug Barton <dougb@FreeBSD.org>
Organization: http://www.FreeBSD.org/
User-Agent: Thunderbird 1.5.0.2 (X11/20060507)
MIME-Version: 1.0
To: Florent Thoumie <flz@FreeBSD.org>
References: <1149161717.29704.16.camel@mayday.esat.net>
In-Reply-To: <1149161717.29704.16.camel@mayday.esat.net>
X-Enigmail-Version: 0.94.0.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: freebsd-rc@FreeBSD.org
Subject: Re: Conventions for variables names in rc.d scripts
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."
	<freebsd-rc.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-rc>,
	<mailto:freebsd-rc-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-rc>
List-Post: <mailto:freebsd-rc@freebsd.org>
List-Help: <mailto:freebsd-rc-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-rc>,
	<mailto:freebsd-rc-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Jun 2006 17:41:58 -0000

Florent Thoumie wrote:
> I'd like to make the following changes in rc.d scripts.
> 
> - Make all script-local all variable names begin with the "_${name}_"
> prefix.

Sounds like a good plan.

> - Make all functions-local variable names begin with the "_" prefix and
> use the "local" keyword.

Not as confident about this one, for two reasons. One I think it's overkill,
and two I'd be worried that some script might actually expect to get a local
copy of the named variable. However, if it gets enough testing, my objection
is not strong enough to say "don't do it."

> This would avoid potential collision with rc.conf variables and other
> variables defined in rc.subr or network.subr that aren't declared local.
> 
> Later I'd like to use the "local" keyword as much as possible in rc.subr
> and network.subr.

We should be doing this anyway. In fact, I would suggest that you introduce
this first, then wait a week or two to start frobbing the scripts themselves
to help isolate the cause of any breakage.

> Are there strong objections against these changes?
> 
> On a different matter, I've noticed that some of our scripts have
> "#!/bin/sh -" shebang line instead of "#!/bin/sh" and just couldn't find
> a good reason for this. Anybody knows why?

Most likely because they were imported from NetBSD that way. I'd say remove
it and test thoroughly. :)

Doug

-- 

    This .signature sanitized for your protection