From owner-svn-src-stable-11@freebsd.org Mon Mar 19 06:45:41 2018 Return-Path: Delivered-To: svn-src-stable-11@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 0506BF55013; Mon, 19 Mar 2018 06:45:41 +0000 (UTC) (envelope-from eadler@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 A236F7DDED; Mon, 19 Mar 2018 06:45:40 +0000 (UTC) (envelope-from eadler@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 95D0C3220; Mon, 19 Mar 2018 06:45:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6jeMN096191; Mon, 19 Mar 2018 06:45:40 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6jegR096190; Mon, 19 Mar 2018 06:45:40 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190645.w2J6jegR096190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331183 - stable/11/usr.sbin/vidcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.sbin/vidcontrol X-SVN-Commit-Revision: 331183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:45:41 -0000 Author: eadler Date: Mon Mar 19 06:45:40 2018 New Revision: 331183 URL: https://svnweb.freebsd.org/changeset/base/331183 Log: MFC r316422: Remove checks that background (bg) colors are not bright and buggy attempts to keep them that way. The bg brightness bit is interpreted as blinking in some modes, but it would barely be useful to disallow setting it when it would give blinking in code which knew when that is. The old code mostly knew this wrong, and added handling errors. It is in fact impossible to know, since future mode switches may change the meaning of the bit many times on the screen and in history. Old versions of vidcontrol disallowed bg color numbers >= 8 in all cases. This is very VGA/syscons-centric. Syscons uses the VGA defaults of blinking fg instead of bright bg in text mode and bright bg in graphics mode. On VGA, this is very easy to toggle at any time, and vt blows away the VGA text mode default at boot time. r146736 changed this to try to allow bg color numbers in graphics mode only. This is even more VGA/syscons-centric, and there are many bugs in this, and many nearby bugs in the parser. These are increased or decreased by differences and bugs in vt and teken. Perhaps the most obvious bug was that almost any vidcontrol command which changes any color or the mode causes an error if the initial fg color is bright. E.g., in syscons text mode, after "vidcontrol lightwhite" to make the fg bright, another "vidcontrol lightwhite" is rejected and buggy fixup code changes the fg to white. This is because the bright fg color creates a bright bg color for the phantom reverse video attribute, so was rejected. (The reverse video attribute is phantom because teken ignores the user's setting of it and simply reverses the fg attributes to create the bg attributes. Sometimes some layer masks off the brightness/blinking bit, but not here.) Perhaps the next most obvious one was that "vidcontrol lightgreen lightblue" was misparsed as 2 settings of the fg instead of 1 setting of the fg and 1 invalid setting of the bg. This is because the parser supports an undocumented syntax with many parsing bugs (an ambiguity gives this one). I recently fix bugs in teken that broke setting of bright fg's and bg's in the normal way. This gave more settings of then, so the old bugs showed up more often. Modified: stable/11/usr.sbin/vidcontrol/vidcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- stable/11/usr.sbin/vidcontrol/vidcontrol.c Mon Mar 19 06:40:11 2018 (r331182) +++ stable/11/usr.sbin/vidcontrol/vidcontrol.c Mon Mar 19 06:45:40 2018 (r331183) @@ -852,8 +852,7 @@ get_normal_colors(int argc, char **argv, int *_index) normal_fore_color=color; colors_changed = 1; if (*_index < argc - && (color = get_color_number(argv[*_index])) != -1 - && color < 8) { + && (color = get_color_number(argv[*_index])) != -1) { (*_index)++; fprintf(stderr, "\033[=%dG", color); normal_back_color=color; @@ -876,8 +875,7 @@ get_reverse_colors(int argc, char **argv, int *_index) revers_fore_color=color; colors_changed = 1; if (*_index < argc - && (color = get_color_number(argv[*_index])) != -1 - && color < 8) { + && (color = get_color_number(argv[*_index])) != -1) { (*_index)++; fprintf(stderr, "\033[=%dI", color); revers_back_color=color; @@ -1489,18 +1487,8 @@ main(int argc, char **argv) get_normal_colors(argc, argv, &optind); - if (colors_changed || video_mode_changed) { - if (!(new_mode_info.vi_flags & V_INFO_GRAPHICS)) { - if ((normal_back_color < 8) && (revers_back_color < 8)) { - set_colors(); - } else { - revert(); - errx(1, "bg color for text modes must be < 8"); - } - } else { - set_colors(); - } - } + if (colors_changed || video_mode_changed) + set_colors(); if ((optind != argc) || (argc == 1)) usage();