From owner-freebsd-rc@FreeBSD.ORG Thu Oct 18 19:26:44 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 9034216A417 for ; Thu, 18 Oct 2007 19:26:44 +0000 (UTC) (envelope-from jhein@timing.com) Received: from Daffy.timing.com (daffy.timing.com [206.168.13.218]) by mx1.freebsd.org (Postfix) with ESMTP id 4744A13C46A for ; Thu, 18 Oct 2007 19:26:44 +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 l9IIxvnK007084 for ; Thu, 18 Oct 2007 12:59:57 -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 l9IIxmFp046536; Thu, 18 Oct 2007 12:59:48 -0600 (MDT) (envelope-from jhein@gromit.timing.com) Received: (from jhein@localhost) by gromit.timing.com (8.14.1/8.14.1/Submit) id l9IIxmij046533; Thu, 18 Oct 2007 12:59:48 -0600 (MDT) (envelope-from jhein) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18199.44324.813707.124793@gromit.timing.com> Date: Thu, 18 Oct 2007 12:59:48 -0600 From: John E Hein To: freebsd-rc@freebsd.org In-Reply-To: <18199.34219.154950.645190@gromit.timing.com> References: <18199.34219.154950.645190@gromit.timing.com> 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 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: Thu, 18 Oct 2007 19:26:44 -0000 John E Hein wrote at 10:11 -0600 on Oct 18, 2007: > I have not yet attempted to narrow down what in .22 (+198 -146) > actually changes the behavior, but the following works around the > problem by converting the newlines to spaces: @@ -699,106 +657,52 @@ $command $rc_flags $command_args" fi fi - # run the full command; - # if the cmd failed and force - # isn't set, exit + # run the full command # - debug "run_rc_command: _doit: $_doit" - eval $_doit - _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && return 1 + _run_rc_doit "$_doit" || return 1 The last diff blob above is the trouble maker. The new run_rc_doit() function does this: + eval "$@" If you remove the quotes, it starts working again. Unfortunately, you can have different problems if you don't quote $@ (for instance, args with spaces become two args). I don't know if yar@ added that to address a specific issue or just to be more future-proof in terms of quoting. But it breaks if the command or args have a newline. Maybe it's best to just do the echo in /etc/rc.d/amd that I showed in the previous email and document that $rc_flags and $command, etc., should not have newlines. Here's that patch again: > Index: amd > =================================================================== > RCS file: /base/FreeBSD-CVS/src/etc/rc.d/amd,v > retrieving revision 1.15.2.3 > diff -u -p -r1.15.2.3 amd > --- amd 22 Oct 2006 20:33:10 -0000 1.15.2.3 > +++ amd 18 Oct 2007 15:57:34 -0000 > @@ -34,7 +34,7 @@ amd_precmd() > [Nn][Oo] | '') > ;; > *) > - rc_flags="${rc_flags} `eval ${amd_map_program}`" > + rc_flags="${rc_flags} `echo $(eval ${amd_map_program})`" > ;; > esac