Date: Fri, 19 Oct 2007 12:59:18 -0600 From: John E Hein <jhein@timing.com> To: Mike Makonnen <mtm@FreeBSD.Org> Cc: freebsd-rc@FreeBSD.Org Subject: Re: rc.subr, 1.34.2.22, breaks amd_map_program="ypcat -k amd.master" in RELENG_6 Message-ID: <18200.65158.288201.786414@gromit.timing.com> In-Reply-To: <20071019182757.GA38833@terra.mike.lan> References: <18199.34219.154950.645190@gromit.timing.com> <18199.44324.813707.124793@gromit.timing.com> <20071019085154.GA3185@terra.mike.lan> <18200.45690.542280.695857@gromit.timing.com> <20071019182757.GA38833@terra.mike.lan>
next in thread | previous in thread | raw e-mail | index | archive | help
Mike Makonnen wrote at 21:27 +0300 on Oct 19, 2007: > On Fri, Oct 19, 2007 at 07:34:50AM -0600, John E Hein wrote: > > If run_rc_command can't have newlines in the vars it uses as > > arguments, then one way to handle the bug is just to document it > > clearly in rc.subr (with the rc_flags and command_args comments). > > I'm not sure that it is needed. In fact, I would normally assume that > any arguments would *not* contain newlines (only spaces) as argument > delimiters. As far as I am concerned, the fact rc.d/amd worked up until > this change is purely coincidental. In other words, the bug was in the > original implementation. It should be up to the script to do > whatever cleanup is needed on its input and try to pass sane values > to the rc.subr(8) routines. It can't hurt to put some hints in the comments in rc.subr what sane values are (i.e., "no newlines, please" ;). But since this is pretty abnormal, I'm not going to lose sleep if it's not documented. > Going the other way and trying to make the run_rc_command() routine > permissive in what it accepts is probably asking for trouble. Agreed. > > A quick glance shows that the /etc/rc.d/syslogd script is the only(?) > > one that does something similar. But it takes pains to convert > > newlines to spaces using tr(1) (although I think it's unnecessary to > > do so in a for loop - so, IMO, that tr(1) is superfluous and could be > > removed for the efficiency conscious - not tested ;). > > I think you're right. I'll take a look at it. Thanks. > It's a matter of correctness. The rc_flags variable should contain only > arguments for the program. Any shell directives or extra switches the > script appends should go in command_args. But you're right, it's a > separate issue. Okay. A subtle distinction, but I see it now in the comments in rc.subr
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18200.65158.288201.786414>