From owner-freebsd-rc@FreeBSD.ORG Fri Oct 19 18:23:47 2007 Return-Path: Delivered-To: freebsd-rc@FreeBSD.Org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C94616A46B for ; Fri, 19 Oct 2007 18:23:47 +0000 (UTC) (envelope-from mtm@FreeBSD.Org) Received: from terra.mike.lan (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B8B6113C46A; Fri, 19 Oct 2007 18:23:39 +0000 (UTC) (envelope-from mtm@FreeBSD.Org) Received: by terra.mike.lan (Postfix, from userid 1000) id 617946780D; Fri, 19 Oct 2007 21:27:58 +0300 (EAT) Date: Fri, 19 Oct 2007 21:27:58 +0300 From: Mike Makonnen To: John E Hein Message-ID: <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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18200.45690.542280.695857@gromit.timing.com> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD/8.0-CURRENT (i386) Cc: freebsd-rc@FreeBSD.Org Subject: Re: rc.subr, 1.34.2.22, breaks amd_map_program="ypcat -k amd.master" in RELENG_6 X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2007 18:23:47 -0000 On Fri, Oct 19, 2007 at 07:34:50AM -0600, John E Hein wrote: > > I agree. > > I think that modifying rc.d/amd is the proper solution here. It's probably > > a bug that it depends on run_rc_command()'s internal behaviour. > > I agree - it'd be best if run_rc_command could handle whatever you > throw at it, but I'm not sure that's practical. > > 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. Going the other way and trying to make the run_rc_command() routine permissive in what it accepts is probably asking for trouble. > > 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. [snip patch] > > That works fine, too (don't need the space in front of '>'), but I > don't see the benefit to splitting it into two variables/lines. Is it > just a preferred style issue? If so, please commit that separately or > note it in the commit message so as not to confuse the issue for > future cvs miners. 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. Cheers. -- Mike Makonnen | GPG-KEY: http://people.freebsd.org/~mtm/mtm.asc mmakonnen @ gmail.com | AC7B 5672 2D11 F4D0 EBF8 5279 5359 2B82 7CD4 1F55 mtm @ FreeBSD.Org | FreeBSD - http://www.freebsd.org