From owner-freebsd-rc@FreeBSD.ORG Thu Oct 20 19:39:32 2005 Return-Path: X-Original-To: freebsd-rc@freebsd.org Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A47816A41F for ; Thu, 20 Oct 2005 19:39:32 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6219643D5A for ; Thu, 20 Oct 2005 19:39:29 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.3/8.13.3) with ESMTP id j9KJdJAk070773; Thu, 20 Oct 2005 23:39:19 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.3/8.13.3/Submit) id j9KJdI2N070771; Thu, 20 Oct 2005 23:39:18 +0400 (MSD) (envelope-from yar) Date: Thu, 20 Oct 2005 23:39:18 +0400 From: Yar Tikhiy To: Dirk Engling Message-ID: <20051020193918.GB69814@comp.chem.msu.su> References: <4357D422.2000200@erdgeist.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4357D422.2000200@erdgeist.org> User-Agent: Mutt/1.5.9i Cc: freebsd-rc@freebsd.org Subject: Re: defunc: /etc/rc.d/jail restart 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, 20 Oct 2005 19:39:32 -0000 On Thu, Oct 20, 2005 at 07:30:10PM +0200, Dirk Engling wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > The /etc/rc.d/jail script does nothing when its restart subcommand is > called. > > This is due to these lines: > > ##### in /etc/rc.d/jail, line 246ff > > cmd="$1" > if [ $# -gt 0 ]; then > ~ shift > fi > [ -n "$*" ] && jail_list="$*" > run_rc_command "${cmd}" > > ##### in /etc/rc.subr, line 773f > > ( $0 ${_rc_prefix}stop $rc_extra_args ) > $0 ${_rc_prefix}start $rc_extra_args IMHO the source of the problem is these two lines. I think they should be replaced by calls to run_rc_command so that the configuration is read only once by load_rc_config in the first (and the only) instance of the script. > ##### in /etc/defaults/rc.conf, line 513 > > jail_list="" # Space separated list of names of jails > > > > > So /etc/rc.d/jail throws away the parameters after saving its value in > $jail_list. It calls /etc/rc.subr which, for the restart command, then > calls /etc/rc.d/jail stop and /etc/rc.d/jail start, which both in turn > source /etc/defaults/rc.conf, which again clears $jail_list. > > My suggestion would be to let /etc/defaults/* just do the job it is > being meant for: providing defaults. This would lead to the following diff. > > > - --- rc.conf Thu Oct 20 19:25:13 2005 > +++ rc.conf_old Thu Oct 20 19:24:16 2005 > @@ -510,7 +510,7 @@ > ~ ### Jail Configuration ####################################### > ~ ############################################################## > ~ jail_enable="NO" # Set to NO to disable starting of any jails > - -jail_list=${jail_list:-""} # Space separated list of names of jails > +jail_list="" # Space separated list of names of jails > ~ jail_set_hostname_allow="YES" # Allow root user in a jail to change its > hostname > ~ jail_socket_unixiproute_only="YES" # Route only TCP/IP within a jail > ~ jail_sysvipc_allow="NO" # Allow SystemV IPC use from within a jail > > > However, theres lots of variables that should not be reset if already > set, I might want to call /etc/rc.d/jail having set up some variables > (including jail_list) myself (which in fact I tried in another project). > > Are there any situation, where accepting variables from environment of > caller can be harmful? > > Regards > > ~ Dirk Engling > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.6 (Darwin) > > iD8DBQFDV9QiImmQdUyYEgkRAm9MAKCOYcJOBj8hQFGcdgGJ/lwRkQnRhACeNjVt > Edbt/WyJy/NtcOEHuS+L4cc= > =jjHt > -----END PGP SIGNATURE----- > _______________________________________________ > freebsd-rc@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-rc > To unsubscribe, send any mail to "freebsd-rc-unsubscribe@freebsd.org" -- Yar