Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Oct 2009 15:01:06 -0700
From:      Doug Barton <dougb@FreeBSD.org>
To:        Hiroki Sato <hrs@FreeBSD.org>
Cc:        Mark Murray <markm@FreeBSD.org>, freebsd-rc@freebsd.org
Subject:   Re: svn commit: r197790 - head/etc
Message-ID:  <4AD3A722.9060401@FreeBSD.org>
In-Reply-To: <200910052011.n95KBXdS024044@svn.freebsd.org>
References:  <200910052011.n95KBXdS024044@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I think this is the wrong solution to the problem. In at least two
cases (routed and route6d) where $command is not defined in the rc.d
scripts this change is resulting in $command not being defined at all.

If you look at the definition of the + parameter substitution this
makes sense:

     ${parameter:+word}
             Use Alternate Value.  If parameter is unset or null, null
             is substituted; otherwise, the expansion of word is
             substituted.

I think that what you really wanted to do was:

Index: rc.subr
===================================================================
--- rc.subr	(revision 198000)
+++ rc.subr	(working copy)
@@ -616,7 +616,7 @@
 	esac

 	eval _override_command=\$${name}_program
-	command=${command:+${_override_command:-$command}}
+	command=${_override_command:-$command}

 	_keywords="start stop restart rcvar $extra_commands"
 	rc_pid=

That actually makes more sense anyway, at least to me since it allows
the user to override the definition of command in rc.conf, which seems
consistent with how we override other things.

Mark, can you revert the band-aids that I supplied previously and try
this instead?

Anyone else have a comment on this idea?


Doug


Hiroki Sato wrote:
> Author: hrs
> Date: Mon Oct  5 20:11:33 2009
> New Revision: 197790
> URL: http://svn.freebsd.org/changeset/base/197790
> 
> Log:
>   Fix a case when both ${name}_program and ${command} are defined.
>   
>   Spotted by:	Michio "Karl" Jinbo
> 
> Modified:
>   head/etc/rc.subr
> 
> Modified: head/etc/rc.subr
> ==============================================================================
> --- head/etc/rc.subr	Mon Oct  5 19:56:56 2009	(r197789)
> +++ head/etc/rc.subr	Mon Oct  5 20:11:33 2009	(r197790)
> @@ -602,7 +602,7 @@ run_rc_command()
>  	esac
>  
>  	eval _override_command=\$${name}_program
> -	command=${command:-${_override_command}}
> +	command=${command:+${_override_command:-$command}}
>  
>  	_keywords="start stop restart rcvar $extra_commands"
>  	rc_pid=
> 


-- 

	Improve the effectiveness of your Internet presence with
	a domain name makeover!    http://SupersetSolutions.com/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4AD3A722.9060401>