From owner-svn-src-head@freebsd.org Sun Feb 18 00:56:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 554E6F238E4; Sun, 18 Feb 2018 00:56:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0063F77D74; Sun, 18 Feb 2018 00:56:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAAB52462A; Sun, 18 Feb 2018 00:56:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0uCvr076914; Sun, 18 Feb 2018 00:56:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0uC96076913; Sun, 18 Feb 2018 00:56:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802180056.w1I0uC96076913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 18 Feb 2018 00:56:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329497 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:56:13 -0000 Author: kevans Date: Sun Feb 18 00:56:12 2018 New Revision: 329497 URL: https://svnweb.freebsd.org/changeset/base/329497 Log: stand/lua: Fix module_path handling with multiple kernels Once we've successfully loaded a kernel, we add its directory to module_path. If we switch kernels with the kernel selector, we again prepend the kernel directory to the current module_path and end up with multiple kernel paths, potentially with mismatched kernel/modules, added to module_path. Fix it by caching module_path at load() time and using the cached version whenever we load a new kernel. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sun Feb 18 00:44:09 2018 (r329496) +++ head/stand/lua/config.lua Sun Feb 18 00:56:12 2018 (r329497) @@ -115,6 +115,7 @@ local pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) + print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end @@ -124,6 +125,7 @@ local pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) + print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end @@ -293,7 +295,9 @@ function config.loadkernel(other_kernel) return false; end else - local module_path = loader.getenv("module_path"); + -- Use our cached module_path, so we don't end up with multiple + -- automatically added kernel paths to our final module_path + local module_path = config.module_path; local res = nil; if other_kernel ~= nil then @@ -308,9 +312,9 @@ function config.loadkernel(other_kernel) loader.setenv("module_path", v); res = load_bootfile(); - -- succeeded add path to module_path + -- succeeded, add path to module_path if res ~= nil then - if module_path ~= nil then + if (module_path ~= nil) then loader.setenv("module_path", v..";".. module_path); end @@ -349,6 +353,9 @@ function config.load(file) end end end + + -- Cache the provided module_path at load time for later use + config.module_path = loader.getenv("module_path"); print("Loading kernel..."); config.loadkernel();