Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Sep 2019 02:48:16 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r352349 - in stable: 11/stand/lua 12/stand/lua
Message-ID:  <201909150248.x8F2mGGD012761@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Sun Sep 15 02:48:15 2019
New Revision: 352349
URL: https://svnweb.freebsd.org/changeset/base/352349

Log:
  MFC r352194: lualoader: Revert to ASCII menu frame for serial console
  
  The box drawing characters we use aren't necessarily safe with a serial
  console; for instance, in the report by npn@, these were causing his xterm
  to send back a sequence that lua picked up as input and halted the boot.
  This is less than ideal.
  
  Fallback to ASCII frames for console with 'comconsole' in it.  This is a
  partial revert r338108 by imp@ -- instead of removing the menu entirely and
  disabling color/cursor sequences, just reverting the default frame to ASCII
  is enough to not break in this setup.

Modified:
  stable/12/stand/lua/core.lua
  stable/12/stand/lua/drawer.lua
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/stand/lua/core.lua
  stable/11/stand/lua/drawer.lua
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/stand/lua/core.lua
==============================================================================
--- stable/12/stand/lua/core.lua	Sun Sep 15 02:46:40 2019	(r352348)
+++ stable/12/stand/lua/core.lua	Sun Sep 15 02:48:15 2019	(r352349)
@@ -325,6 +325,16 @@ function core.isZFSBoot()
 	return false
 end
 
+function core.isSerialConsole()
+	local c = loader.getenv("console")
+	if c ~= nil then
+		if c:find("comconsole") ~= nil then
+			return true
+		end
+	end
+	return false
+end
+
 function core.isSerialBoot()
 	local s = loader.getenv("boot_serial")
 	if s ~= nil then

Modified: stable/12/stand/lua/drawer.lua
==============================================================================
--- stable/12/stand/lua/drawer.lua	Sun Sep 15 02:46:40 2019	(r352348)
+++ stable/12/stand/lua/drawer.lua	Sun Sep 15 02:48:15 2019	(r352349)
@@ -144,13 +144,20 @@ local function drawmenu(menudef)
 	return alias_table
 end
 
+local function defaultframe()
+	if core.isSerialConsole() then
+		return "ascii"
+	end
+	return "double"
+end
+
 local function drawbox()
 	local x = menu_position.x - 3
 	local y = menu_position.y - 1
 	local w = frame_size.w
 	local h = frame_size.h
 
-	local framestyle = loader.getenv("loader_menu_frame") or "double"
+	local framestyle = loader.getenv("loader_menu_frame") or defaultframe()
 	local framespec = drawer.frame_styles[framestyle]
 	-- If we don't have a framespec for the current frame style, just don't
 	-- draw a box.



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