Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Mar 2011 15:46:09 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Doug Barton <dougb@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r219578 - head/etc
Message-ID:  <20110313144609.GA11779@stack.nl>
In-Reply-To: <4D7C7CC9.7010901@FreeBSD.org>
References:  <201103122113.p2CLD8LO030205@svn.freebsd.org> <20110312230830.GA269@stack.nl> <4D7C7CC9.7010901@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 13, 2011 at 12:14:01AM -0800, Doug Barton wrote:
> On 03/12/2011 15:08, Jilles Tjoelker wrote:
> > I wonder if it is a good idea to pollute the environment of many daemons
> > with this. Although sshd and cron clean it up, there is at least one
> > daemon that passes the environment on. One of those is devd.

> I think the argument could be made that this is bad behavior on their 
> part, but if it turns out that it starts affecting things negatively we 
> can take another look at it.

Cleaning the environment requires special care to preserve environment
variables that may still be needed. This is a problem particularly for
code intended to be portable. Perhaps someone wants to apply a hack
using LD_PRELOAD or other LD_* variables, or an environment variable is
needed to force standards-compliant behaviour that the program depends
on.

The service(8) utility should clear the environment so it matches the
boot environment as much as possible. If someone wants to set special
environment variables, they should configure that in such a way that it
also works at boot or call the rc.d script directly.

> > While that
> > saves four /etc/rc.conf reads on my minimalistic 9-current VM, it
> > implies that devd must be restarted to pick up changes to /etc/rc.conf.
> > That seems a POLA violation.

> I'm not sure what you mean by this. We've always required services to be 
> restarted to pick up rc.conf changes.

For options for devd itself, yes. However, as configured in the default
/etc/devd.conf, devd may invoke commands like
  /etc/pccard_ether $subsystem start
or
  /etc/rc.d/dhclient quietstart $subsystem

The natural expectation is that these reread /etc/rc.conf every time, so
that it is possible to set up network settings for a network interface
and then plug it in, without restarting devd. And so it worked before
r219578.

Also, consider the case where settings are changed in /etc/rc.conf and
then applied by manual running of rc.d scripts. With the new code,
unplugging and replugging the device, triggering devd, reverts the
settings to their boot-time values.

Another unexpected result may occur if /etc/rc.conf.d/devd modifies a
variable defined in /etc/defaults/rc.conf or /etc/rc.conf. The change
will now apply to everything started by devd as well, different from
former behaviour. This is not that likely for devd as it has few defined
variables, but may affect other daemons and also affects running an rc.d
script from another via run_rc_script.

-- 
Jilles Tjoelker



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