tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

rc.subr warning about undefined variables



On Sun, 04 Oct 2009, Robert Elz wrote:
>   | (2) Provide a default value of NO for the control variables. This
>   | ensures that no stupid "Missing variable $foo" clutters up the
>   | boot messages.
  [...]
> After all, all the base system scripts have (or should have) their
> control variables in /etc/defaults/rc.conf so the test can really only
> be for add on scripts, which is mostly pkgsrc added scripts, if pkgsrc
> then defeats that by always defining the variables, the test has no
> purpose left, and may as well be rmeoved.

That test appeared in rc.subr revision 1.1 dated 1997-08-29.
/etc/default/rc.conf apepared on 2000-08-22, and moved to
/etc/defaults/rc.conf on 2000-10-01.

The test might have made sense for the base system back in the time
before /etc/defaults/rc.conf existed, when variables had to be set
excplicitly in /etc/rc.conf, but I don't think it makes sense for
the base system today, and the warnings for pkgsrc scripts annoyed
me enough that I removed the warning from my own rc.subr a long
time ago.  I suggest that the warning

        warn "\$${1} is not set properly - see ${rcvar_manpage}."

should be removed from the checkyesno function in the base system's
/etc.rc.subr.

Whether or not pkgsrc-supplied scripts leave their variables
undefined by default is a separate issue from whether or not rc.subr
warns about undefined variables.  I don't care either way about
this separate issue.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index