rc.d namespace

Doug Barton dougb at FreeBSD.org
Wed Dec 27 16:23:47 PST 2006


Yar Tikhiy wrote:
> Hi folks,
> 
> My attention has been drawn by the fact that rc.subr and rc.d/*
> don't seem to follow uniform namespace rules. 

In general I'm in favor of consistency, but could you be more specific
about what problem you're trying to solve?

> Namely both rc.subr
> and rc.d use global identifiers starting with an underscore.
> Fortunately, rc.subr doesn't seem to use global identifiers not
> starting with an underscore besides the names exported to scripts
> on purpose.

That's good news.

> What do you think about adopting the following rule: "_foo" names
> are for the rc.subr internals while just "foo" names are for rc.d
> scripts? 

That works for me, especially if we don't have to make a lot of
gratuitous changes to rc.subr. I would like to minimize the pain of
adopting any new stuff from NetBSD if possible.

> Another possible way is: __foo or even __rc_foo for
> rc.subr, _foo for scripts, foo for the documented rc.subr interface.

Personally I think that's too much drama. Since they are executed in a
subshell, I don't really see a need for variables in individual rc.d
scripts to be so careful about their namespace that they need
something like _foo to start with, so I'd rather "enforce" this for
the scripts than make radical changes to rc.d itself.

Doug

-- 

    This .signature sanitized for your protection



More information about the freebsd-rc mailing list