From owner-svn-src-all@FreeBSD.ORG Mon Jul 11 15:14:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C64B106564A; Mon, 11 Jul 2011 15:14:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 6152C8FC0C; Mon, 11 Jul 2011 15:14:50 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 16DC646B2A; Mon, 11 Jul 2011 11:14:50 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 94D1E8A02F; Mon, 11 Jul 2011 11:14:49 -0400 (EDT) From: John Baldwin To: Doug Barton Date: Mon, 11 Jul 2011 11:14:32 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110617; KDE/4.5.5; amd64; ; ) References: <201107102347.p6ANl3qK066321__21248.7196004533$1310341655$gmane$org@svn.freebsd.org> <86ipr9sl4j.fsf@gmail.com> <4E1A498B.9080506@FreeBSD.org> In-Reply-To: <4E1A498B.9080506@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201107111114.33159.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 11 Jul 2011 11:14:49 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pan Tsu Subject: Re: svn commit: r223917 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2011 15:14:50 -0000 On Sunday, July 10, 2011 8:53:31 pm Doug Barton wrote: > On 07/10/2011 17:42, Pan Tsu wrote: > > Doug Barton writes: > > > >> Author: dougb > >> Date: Sun Jul 10 23:47:03 2011 > >> New Revision: 223917 > >> URL: http://svn.freebsd.org/changeset/base/223917 > >> > >> Log: > >> Make sure we load kernel modules from the same path as the running kernel > >> > >> Modified: > >> head/etc/rc.d/kld > >> > >> Modified: head/etc/rc.d/kld > >> ============================================================================== > >> --- head/etc/rc.d/kld Sun Jul 10 22:09:53 2011 (r223916) > >> +++ head/etc/rc.d/kld Sun Jul 10 23:47:03 2011 (r223917) > >> @@ -41,11 +41,24 @@ kld_start() > >> { > >> [ -n "$kld_list" ] || return > >> > >> - local _kld > >> + local _kernel_path _module_path _kld _path > >> + > >> + _kernel_path=`$SYSCTL_N kern.bootfile` > >> + _kernel_path="${_kernel_path%/*}" > >> + > >> + _module_path=`$SYSCTL_N kern.module_path` > >> + _module_path="${_module_path#*\;}" > >> + _module_path="$_kernel_path `ltr $_module_path \; ' '`" > > [...] > > > > Doesn't /boot/support.4th already populates kern.module_path with > > the path of successfully booted kernel? How is this different? > > When you test it, what happens? If you do 'boot foo' at the loader prompt you get /boot/foo;/boot/kernel;/boot/modules. It is arguably broken that the old /boot/kernel is still in the list, but that bug should be fixed in the loader, not here. However, I've never had a problem with kldload doing the wrong thing when using 'boot foo'. Do you have an actual use case that is broken? Oh, and if you use 'nextboot -k foo' or set 'kernel=foo' in loader.conf then it will DTRT. However, I would expect this script to be equivalent to a for loop of 'kldload foo', but now it isn't since you are using a divergent algorithm. That violates POLA IMO. -- John Baldwin