Date: Thu, 18 Oct 2007 12:59:48 -0600 From: John E Hein <jhein@timing.com> To: 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: <18199.44324.813707.124793@gromit.timing.com> In-Reply-To: <18199.34219.154950.645190@gromit.timing.com> References: <18199.34219.154950.645190@gromit.timing.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18199.44324.813707.124793>