From owner-svn-src-head@freebsd.org Fri Sep 20 19:43:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE57212560E; Fri, 20 Sep 2019 19:43:41 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Zkfj57xMz4XYc; Fri, 20 Sep 2019 19:43:41 +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 836B729C8; Fri, 20 Sep 2019 19:43:41 +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 x8KJhfYW048951; Fri, 20 Sep 2019 19:43:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KJhegB048949; Fri, 20 Sep 2019 19:43:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909201943.x8KJhegB048949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 20 Sep 2019 19:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352559 - in head/stand: forth lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: forth lua X-SVN-Commit-Revision: 352559 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.29 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: Fri, 20 Sep 2019 19:43:41 -0000 Author: kevans Date: Fri Sep 20 19:43:40 2019 New Revision: 352559 URL: https://svnweb.freebsd.org/changeset/base/352559 Log: loader: Respect loader_color=YES for serial consoles It's not uncommon these days for the terminals attached to serial consoles to support ANSI escape sequences. However, we assume escape sequences may break some serial consoles and default to not using them when boot_serial or boot_multicons (or if console contains "comconsole" in the forth loader) for broader compatibility. We also have loader_color which can be explicitly set to "NO" to disable the use of ANSI escape sequences. The problem is that loader_color=YES gets ignored when boot_serial=YES or boot_multicons=YES (or when console contains "comconsole" in the forth loader). To fix, the existing default behavior remains unchanged when loader_color is unset, loader_color=NO explicitly disables the use of ANSI escape sequences still, and the change is that loader_color=YES can now be used to explicitly allow ANSI escapes when a serial console is enabled. Submitted by: Ryan Moeller Reviewed by: tsoome (forth), kevans (lua) MFC after: 1 week Sponsored by: iXsystems, Inc. (Ryan) Differential Revision: https://reviews.freebsd.org/D21732 Modified: head/stand/forth/color.4th head/stand/lua/color.lua Modified: head/stand/forth/color.4th ============================================================================== --- head/stand/forth/color.4th Fri Sep 20 17:37:23 2019 (r352558) +++ head/stand/forth/color.4th Fri Sep 20 19:43:40 2019 (r352559) @@ -27,12 +27,14 @@ marker task-color.4th \ This function returns FALSE if the `loader_color' environment variable is set -\ to NO, no, or 0. Otherwise, TRUE is returned (unless booting serial). +\ to NO, no, or 0. It returns TRUE if `loader_color' is set to any other value. +\ If `loader_color' is unset, TRUE is returned (unless booting serial). \ -: loader_color? ( -- N ) +: loader_color? ( -- t ) s" loader_color" getenv dup -1 <> if - + \ `loader_color' is set. + \ Check if it is explicitly disabled. 2dup s" NO" compare-insensitive 0= if 2drop FALSE exit @@ -42,8 +44,12 @@ marker task-color.4th FALSE exit then drop + \ It is enabled. + TRUE + else + \ `loader_color' is unset. + \ Default to using color unless serial boot is active. + drop + boot_serial? 0= then - drop - - boot_serial? if FALSE else TRUE then ; Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Fri Sep 20 17:37:23 2019 (r352558) +++ head/stand/lua/color.lua Fri Sep 20 19:43:40 2019 (r352559) @@ -49,9 +49,7 @@ color.DIM = 2 function color.isEnabled() local c = loader.getenv("loader_color") if c ~= nil then - if c:lower() == "no" or c == "0" then - return false - end + return c:lower() ~= "no" and c ~= "0" end return not core.isSerialBoot() end