Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Jun 2006 10:41:13 -0700
From:      Doug Barton <dougb@FreeBSD.org>
To:        Florent Thoumie <flz@FreeBSD.org>
Cc:        freebsd-rc@FreeBSD.org
Subject:   Re: Conventions for variables names in rc.d scripts
Message-ID:  <447F26B9.3030601@FreeBSD.org>
In-Reply-To: <1149161717.29704.16.camel@mayday.esat.net>
References:  <1149161717.29704.16.camel@mayday.esat.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?447F26B9.3030601>