Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Mar 2019 02:33:27 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345517 - head/stand/lua
Message-ID:  <201903260233.x2Q2XRc0081866@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Tue Mar 26 02:33:27 2019
New Revision: 345517
URL: https://svnweb.freebsd.org/changeset/base/345517

Log:
  lualoader: Clear the screen before prompting for password
  
  Assuming that the autoboot sequence was interrupted, we've done enough
  cursor manipulation that the prompt for the password will be sufficiently
  obscured a couple of lines up. Clear the screen and reset the cursor
  position here, too.
  
  MFC after:	1 week

Modified:
  head/stand/lua/password.lua

Modified: head/stand/lua/password.lua
==============================================================================
--- head/stand/lua/password.lua	Tue Mar 26 02:21:09 2019	(r345516)
+++ head/stand/lua/password.lua	Tue Mar 26 02:33:27 2019	(r345517)
@@ -40,6 +40,12 @@ local show_password_mask = false
 local twiddle_chars = {"/", "-", "\\", "|"}
 local screen_setup = false
 
+local function setup_screen()
+	screen.clear()
+	screen.defcursor()
+	screen_setup = true
+end
+
 -- Module exports
 function password.read(prompt_length)
 	local str = ""
@@ -90,9 +96,7 @@ function password.check()
 		end
 
 		if not screen_setup then
-			screen.clear()
-			screen.defcursor()
-			screen_setup = true
+			setup_screen()
 		end
 
 		while true do
@@ -131,6 +135,11 @@ function password.check()
 	local pwd = loader.getenv("password")
 	if pwd ~= nil then
 		core.autoboot()
+		-- The autoboot sequence was interrupted, so we'll need to
+		-- prompt for a password.  Put the screen back into a known
+		-- good state, otherwise we're drawing back a couple lines
+		-- in the middle of other text.
+		setup_screen()
 	end
 	compare("Loader password:", pwd)
 end



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