From owner-freebsd-rc@FreeBSD.ORG Fri Oct 19 18:59:55 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 180CB16A417; Fri, 19 Oct 2007 18:59:55 +0000 (UTC) (envelope-from jhein@timing.com) Received: from Daffy.timing.com (smtp.timing.com [206.168.13.218]) by mx1.freebsd.org (Postfix) with ESMTP id 1DD9D13C45D; Fri, 19 Oct 2007 18:59:40 +0000 (UTC) (envelope-from jhein@timing.com) Received: from gromit.timing.com (gromit.timing.com [206.168.13.209]) by Daffy.timing.com (8.13.1/8.13.1) with ESMTP id l9JIxMee095162; Fri, 19 Oct 2007 12:59:22 -0600 (MDT) (envelope-from jhein@timing.com) Received: from gromit.timing.com (localhost [127.0.0.1]) by gromit.timing.com (8.14.1/8.14.1) with ESMTP id l9JIxILF083772; Fri, 19 Oct 2007 12:59:18 -0600 (MDT) (envelope-from jhein@gromit.timing.com) Received: (from jhein@localhost) by gromit.timing.com (8.14.1/8.14.1/Submit) id l9JIxI96083769; Fri, 19 Oct 2007 12:59:18 -0600 (MDT) (envelope-from jhein) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18200.65158.288201.786414@gromit.timing.com> Date: Fri, 19 Oct 2007 12:59:18 -0600 From: John E Hein To: Mike Makonnen 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> X-Mailer: VM 7.19 under Emacs 22.0.99.1 X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on Daffy.timing.com X-Virus-Status: Clean 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:59:55 -0000 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