From owner-svn-src-head@freebsd.org Sat Aug 25 04:28:03 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 02DB010A046F; Sat, 25 Aug 2018 04:28:03 +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 ACC9F8823E; Sat, 25 Aug 2018 04:28:02 +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 73B9F1AFED; Sat, 25 Aug 2018 04:28:02 +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 w7P4S2bi027421; Sat, 25 Aug 2018 04:28:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7P4S2KX027420; Sat, 25 Aug 2018 04:28:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201808250428.w7P4S2KX027420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 25 Aug 2018 04:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338309 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 338309 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.27 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: Sat, 25 Aug 2018 04:28:03 -0000 Author: kevans Date: Sat Aug 25 04:28:02 2018 New Revision: 338309 URL: https://svnweb.freebsd.org/changeset/base/338309 Log: lualoader: Fix override of module_path on loader prompt Earlier changes setup a config.module_path variable that was populated upon reading of loader.conf(5) and used for restoring module_path to pristine condition if multiple kernels are attempted. This broke the ability to override module_path at the loader prompt in case of emergency. Approved by: re (rgrimes) Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Fri Aug 24 22:48:19 2018 (r338308) +++ head/stand/lua/config.lua Sat Aug 25 04:28:02 2018 (r338309) @@ -479,6 +479,21 @@ function config.loadKernel(other_kernel) return nil end + local function getModulePath() + local module_path = loader.getenv("module_path") + local kernel_path = loader.getenv("kernel_path") + + if kernel_path == nil then + return module_path + end + + -- Strip the loaded kernel path from module_path. This currently assumes + -- that the kernel path will be prepended to the module_path when it's + -- found. + kernel_path = escapeName(kernel_path .. ';') + return module_path:gsub(kernel_path, '') + end + local function loadBootfile() local bootfile = loader.getenv("bootfile") @@ -507,7 +522,7 @@ function config.loadKernel(other_kernel) else -- 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 module_path = getModulePath() local res if other_kernel ~= nil then @@ -527,6 +542,7 @@ function config.loadKernel(other_kernel) if module_path ~= nil then loader.setenv("module_path", v .. ";" .. module_path) + loader.setenv("kernel_path", v) end return true end @@ -563,8 +579,6 @@ function config.load(file, reloading) checkNextboot() - -- Cache the provided module_path at load time for later use - config.module_path = loader.getenv("module_path") local verbose = loader.getenv("verbose_loading") or "no" config.verbose = verbose:lower() == "yes" if not reloading then