NetBSD Problem Report #56223

From www@netbsd.org  Mon May 31 21:23:59 2021
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C8E981A928D
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 May 2021 21:23:58 +0000 (UTC)
Message-Id: <20210531212357.781E91A928E@mollari.NetBSD.org>
Date: Mon, 31 May 2021 21:23:57 +0000 (UTC)
From: davshao@gmail.com
Reply-To: davshao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Compilation as root for various pkgsrc packages screws up the console
X-Send-Pr-Version: www-1.0

>Number:         56223
>Category:       kern
>Synopsis:       some vt codes result in blank console
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gutteridge
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 31 21:25:00 +0000 2021
>Closed-Date:    Wed Nov 29 22:06:43 +0000 2023
>Last-Modified:  Wed Nov 29 22:06:43 +0000 2023
>Originator:     David Shao
>Release:        
>Organization:
>Environment:
NetBSD xxxxxx.xxx 9.99.82 NetBSD 9.99.82 (GENERIC) #3: Mon May 31 19:06:15 UTC 2021  xxxxxx@xxxxxx.xxx:/usr/obj/sys/arch/amd64/compile/GENERIC amd64

>Description:
When in console as root on various machines, such as one with an Intel Ivy Bridge integrated graphics or one with a CAICO AMD Radeon graphics card, simply doing something like

cd /usr/pkgsrc/pkgtools/cwrappers
make clean && make replace package clean
cd /usr/pkgsrc/pkgtools/digest
make clean && make replace package clean
cd /usr/pkgsrc/devel/gmake
make clean && make replace package clean

in the make portion of gmake causes characters to stop being displayed on the console.  This is not observed if building in native or modular xorg or building while ssh-ing.  The command appears to finish.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 screws up the console
Date: Fri, 4 Jun 2021 16:34:14 +0000

 On Mon, May 31, 2021 at 09:25:00PM +0000, davshao@gmail.com wrote:
  > When in console as root on various machines, such as one with an
  > Intel Ivy Bridge integrated graphics or one with a CAICO AMD Radeon
  > graphics card, simply doing something like
  > 
  > cd /usr/pkgsrc/pkgtools/cwrappers
  > make clean && make replace package clean
  > cd /usr/pkgsrc/pkgtools/digest
  > make clean && make replace package clean
  > cd /usr/pkgsrc/devel/gmake
  > make clean && make replace package clean
  > 
  > in the make portion of gmake causes characters to stop being
  > displayed on the console.  This is not observed if building in
  > native or modular xorg or building while ssh-ing.  The command
  > appears to finish.

 (a) [you know this] don't build as root (though if it's specific to
 being root vs. just being on the console that would be interesting
 info)

 (b) is it not displaying or is the console wedged? e.g. after it
 finishes, if you type ^G, does it beep? can you start other commands
 by typing blind?

 (c) is it repeatable and is there a specific package it's linked to,
 or is it e.g. the result of scrolling a lot or too quickly? Might be
 interesting to check if e.g. uuencode /netbsd /netbsd and letting that
 scroll triggers it.

 -- 
 David A. Holland
 dholland@netbsd.org

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org, dholland-bugs@netbsd.org
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 screws up the console
Date: Fri, 04 Jun 2021 13:17:11 -0400

 On Fri, 4 Jun 2021 at 16:35:02 +0000 (UTC), David Holland wrote:
   >On Mon, May 31, 2021 at 09:25:00PM +0000, davshao%gmail.com@localhost 
 wrote:
   > > When in console as root on various machines, such as one with an
   > > Intel Ivy Bridge integrated graphics or one with a CAICO AMD Radeon
   > > graphics card, simply doing something like
   > >
   > > cd /usr/pkgsrc/pkgtools/cwrappers
   > > make clean && make replace package clean
   > > cd /usr/pkgsrc/pkgtools/digest
   > > make clean && make replace package clean
   > > cd /usr/pkgsrc/devel/gmake
   > > make clean && make replace package clean
   > >
   > > in the make portion of gmake causes characters to stop being
   > > displayed on the console.  This is not observed if building in
   > > native or modular xorg or building while ssh-ing.  The command
   > > appears to finish.
   >
   >(a) [you know this] don't build as root (though if it's specific to
   >being root vs. just being on the console that would be interesting
   >info)

   I'm able to reproduce this on a machine running -current with Ivy 
 Bridge
   graphics (but not on a machine running 9.2 with Radeon Kaveri). It
   doesn't relate to running as root, it's reproducible as any user.

   >(b) is it not displaying or is the console wedged? e.g. after it
   >finishes, if you type ^G, does it beep? can you start other commands
   >by typing blind?

   For me, it simply isn't displaying. It's not wedged, it will still
   accept and run commands, it's just the display is lost. Typing "exit"
   gets me back to a visible login prompt.

   >(c) is it repeatable and is there a specific package it's linked to,
   >or is it e.g. the result of scrolling a lot or too quickly? Might be
   >interesting to check if e.g. uuencode /netbsd /netbsd and letting that
   >scroll triggers it.

   It's reproducible for me by building anything that causes GCC to use
   particular escape codes for formatting warning messages. E.g., it's
   easily reproducible by typing "make package" in x11/xscreensaver. It is
   also reproducible by capturing the output of one of those builds using
   script(1), then using cat(1) to display it on the console. When it hits
   particular escape codes, the display goes blank.

   Dave

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 screws up the console
Date: Fri, 4 Jun 2021 17:23:14 +0000

 On Fri, Jun 04, 2021 at 05:20:01PM +0000, David H. Gutteridge wrote:
  >    For me, it simply isn't displaying. It's not wedged, it will still
  >    accept and run commands, it's just the display is lost. Typing "exit"
  >    gets me back to a visible login prompt.

 Does typing echo <esc>c (to reset the terminal) fix it? (I'd expect so)

  >    >(c) is it repeatable and is there a specific package it's linked to,
  >    >or is it e.g. the result of scrolling a lot or too quickly? Might be
  >    >interesting to check if e.g. uuencode /netbsd /netbsd and letting that
  >    >scroll triggers it.
  >  
  >    It's reproducible for me by building anything that causes GCC to use
  >    particular escape codes for formatting warning messages. E.g., it's
  >    easily reproducible by typing "make package" in x11/xscreensaver. It is
  >    also reproducible by capturing the output of one of those builds using
  >    script(1), then using cat(1) to display it on the console. When it hits
  >    particular escape codes, the display goes blank.

 Do you know which ones? That seems like the next step...

 -- 
 David A. Holland
 dholland@netbsd.org

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 screws up the console
Date: Fri, 4 Jun 2021 21:09:04 +0300

 On Fri, Jun 04, 2021 at 17:20:01 +0000, David H. Gutteridge wrote:

 >    It's reproducible for me by building anything that causes GCC to use
 >    particular escape codes for formatting warning messages. E.g., it's
 >    easily reproducible by typing "make package" in x11/xscreensaver. It is
 >    also reproducible by capturing the output of one of those builds using
 >    script(1), then using cat(1) to display it on the console. When it hits
 >    particular escape codes, the display goes blank.

 Have you identified which particular one it is?

 -uwe

Responsible-Changed-From-To: misc-bug-people->kern-bug-people
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Fri, 04 Jun 2021 18:34:49 +0000
Responsible-Changed-Why:
Definitely a kernel bug. Also, I updated the synopsis.


From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org, "uwe@stderr.spb.ru" <dholland-bugs@netbsd.org>,
 dholland-bugs@netbsd.org
Cc: 
Subject: Re: kern/56223 (some vt codes result in blank console)
Date: Fri, 04 Jun 2021 16:23:58 -0400

 I have a sample reproducer. An example is the second line below (as
 output here by "cat -v"), which has an escape sequence trying to
 function as a web link:

 xjack.c: In function 'xjack_draw':^M
 xjack.c:350:34: warning: array subscript has type 'char' 
 [^[]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wchar-subscripts^G-Wchar-subscripts^[]8;;^G]^M
    350 |       if ((tolower(c) != tolower(*st->s))^M
        |                                  ^^M

 I've placed the reproducer file at
 http://www.netbsd.org/~gutteridge/PR56223_reproducer.txt

 Dave

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/56223 (some vt codes result in blank console)
Date: Fri, 4 Jun 2021 22:02:17 -0000 (UTC)

 david@gutteridge.ca ("David H. Gutteridge") writes:

 > I've placed the reproducer file at
 > http://www.netbsd.org/~gutteridge/PR56223_reproducer.txt

 That output ESC + ] starts an escape sequence that never ended. The parser
 just continues reading characters that don't cause something rendered as
 these belong to a very long sequence.

 You can finish the sequence by emitting the characters ESC and \.

 The same happens for ESC + ^ and ESC + _.

         case ']': /* OSC operating system command */
         case '^': /* PM privacy message */
         case '_': /* APC application program command */
                 /* ignored */
                 return VT100_EMUL_STATE_STRING;


From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 screws up the console
Date: Sat, 5 Jun 2021 01:28:28 +0300

 > That output ESC + ] starts an escape sequence that never ended.  The
 > parser just continues reading characters that don't cause something
 > rendered as these belong to a very long sequence.

 I'm pretty sure I remember a PR about this.  In the quoted gcc output
 the ^G is supposed to terminate it.  It's not standard but, iirc,
 several emulators accept it as a terminator.

 -uwe

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 screws up the console
Date: Sat, 5 Jun 2021 01:31:00 +0300

 On Sat, Jun 05, 2021 at 01:28:28 +0300, Valery Ushakov wrote:

 > I'm pretty sure I remember a PR about this.  In the quoted gcc output
 > the ^G is supposed to terminate it.  It's not standard but, iirc,
 > several emulators accept it as a terminator.

 PR kern/53245

 -uwe

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages screws up the console
Date: Fri, 4 Jun 2021 22:51:08 -0000 (UTC)

 uwe@stderr.spb.ru (Valery Ushakov) writes:

 > > I'm pretty sure I remember a PR about this.  In the quoted gcc output
 > > the ^G is supposed to terminate it.  It's not standard but, iirc,
 > > several emulators accept it as a terminator.
 > 
 > PR kern/53245

 Maybe this:

 Index: wsemul_vt100.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/wscons/wsemul_vt100.c,v
 retrieving revision 1.46
 diff -p -u -r1.46 wsemul_vt100.c
 --- wsemul_vt100.c      10 Nov 2019 21:16:38 -0000      1.46
 +++ wsemul_vt100.c      4 Jun 2021 22:50:42 -0000
 @@ -763,6 +763,11 @@ wsemul_vt100_output_string(struct wsemul
  {
         struct vt100base_data *vd = &edp->bd;

 +       if (c == ASCII_BEL) {
 +               wsemul_vt100_handle_dcs(vd);
 +               return VT100_EMUL_STATE_NORMAL;
 +       }
 +
         if (vd->dcstype && vd->dcspos < DCS_MAXLEN)
                 vd->dcsarg[vd->dcspos++] = c;
         return VT100_EMUL_STATE_STRING;

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 screws up the console
Date: Sat, 5 Jun 2021 02:40:48 +0300

 On Fri, Jun 04, 2021 at 22:55:01 +0000, Michael van Elst wrote:

 >  Maybe this:

 Yes, though please, use that other PR for the commit log
 cross-reference.

 I didn't commit this back then b/c people that use make believe escape
 sequences instead of the real ones get what they ask for, IMHO :).
 But since every other program wants to emit escape sequences now,
 resistance is futile I guess.

 -uwe

From: Rin Okuyama <rokuyama.rk@gmail.com>
To: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, davshao@gmail.com
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 screws up the console
Date: Sat, 5 Jun 2021 08:54:41 +0900

 On 2021/06/05 7:35, Valery Ushakov wrote:
 > The following reply was made to PR kern/56223; it has been noted by GNATS.
 > 
 > From: Valery Ushakov <uwe@stderr.spb.ru>
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 >   screws up the console
 > Date: Sat, 5 Jun 2021 01:31:00 +0300
 > 
 >   On Sat, Jun 05, 2021 at 01:28:28 +0300, Valery Ushakov wrote:
 >   
 >   > I'm pretty sure I remember a PR about this.  In the quoted gcc output
 >   > the ^G is supposed to terminate it.  It's not standard but, iirc,
 >   > several emulators accept it as a terminator.
 >   
 >   PR kern/53245

 OpenBSD supports ^G as a terminator of string state:

 http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/wscons/wsemul_vt100.c#rev1.28

 Minimum adjust for ours would be:

 https://gist.github.com/rokuyama/8250f98eaaeb3e7765380e69a9be478b

 At least, console does not become blank with David's reproducer.

 Thoughts?

 Thanks,
 rin

From: Rin Okuyama <rokuyama.rk@gmail.com>
To: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, davshao@gmail.com
Cc: Michael van Elst <mlelstv@serpens.de>, Valery Ushakov <uwe@stderr.spb.ru>
Subject: Re: kern/56223: some vt codes result in blank console
Date: Mon, 7 Jun 2021 13:45:19 +0900

 Oops, I didn't notice, somehow, the patch was already submitted.
 Please ignore mine, and commit it. I'm sorry for noise.

 Thanks,
 rin

From: Michael van Elst <mlelstv@serpens.de>
To: Rin Okuyama <rokuyama.rk@gmail.com>
Cc: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, davshao@gmail.com,
	Valery Ushakov <uwe@stderr.spb.ru>
Subject: Re: kern/56223: some vt codes result in blank console
Date: Mon, 7 Jun 2021 07:04:00 +0200

 On Mon, Jun 07, 2021 at 01:45:19PM +0900, Rin Okuyama wrote:
 > Oops, I didn't notice, somehow, the patch was already submitted.
 > Please ignore mine, and commit it. I'm sorry for noise.

 I would, but my patch is wrong as I didn't see that control codes (c0c1)
 are not sent to the per-state routines.

 Greetings,
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Rin Okuyama <rokuyama.rk@gmail.com>
To: Michael van Elst <mlelstv@serpens.de>
Cc: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, davshao@gmail.com,
 Valery Ushakov <uwe@stderr.spb.ru>
Subject: Re: kern/56223: some vt codes result in blank console
Date: Mon, 7 Jun 2021 14:30:17 +0900

 On 2021/06/07 14:04, Michael van Elst wrote:
 > I would, but my patch is wrong as I didn't see that control codes (c0c1)
 > are not sent to the per-state routines.

 Here is the problem:

 https://nxr.netbsd.org/xref/src/sys/dev/wscons/wsemul_vt100.c#984

 control codes are unconditionally eaten by wsemul_vt100_output_c0c1().

 Thanks,
 rin

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56223 CVS commit: src/sys/dev/wscons
Date: Mon, 7 Jun 2021 11:52:08 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon Jun  7 15:52:08 UTC 2021

 Modified Files:
 	src/sys/dev/wscons: wsemul_vt100.c

 Log Message:
 PR/56223: David Shao ^[]8;;^G make console unresponsive. From OpenBSD:
 In `string' state, accept bell (^G) as an end of sequence in addition to
 `ESC \', as supported by xterm; some third-party software such as
 ncmpcpp rely upon this.


 To generate a diff of this commit:
 cvs rdiff -u -r1.46 -r1.47 src/sys/dev/wscons/wsemul_vt100.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Jun 2021 17:32:09 +0000
State-Changed-Why:
should get into -9


From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/56223: Compilation as root for various pkgsrc packages
 screws up the console
Date: Mon, 7 Jun 2021 23:52:52 -0700

 Tested latest fix -- it works enabling building pkgsrc devel/gmake in
 console without the glitch on a
 native X11 machine with a Radeon CAICOS card, a native X11 machine
 with Ivy Bridge Intel integrated
 graphics, and a modular X11 machine with Ivy Bridge integrated
 graphics.  Thanks!

Responsible-Changed-From-To: kern-bug-people->gutteridge
Responsible-Changed-By: gutteridge@NetBSD.org
Responsible-Changed-When: Tue, 28 Nov 2023 02:14:51 +0000
Responsible-Changed-Why:
Take this until pullups are completed.

State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: gutteridge@NetBSD.org
State-Changed-When: Tue, 28 Nov 2023 19:12:50 +0000
State-Changed-Why:
Pullup #1772 for netbsd-9 branch submitted.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56223 CVS commit: [netbsd-9] src/sys/dev/wscons
Date: Wed, 29 Nov 2023 18:59:01 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed Nov 29 18:59:00 UTC 2023

 Modified Files:
 	src/sys/dev/wscons [netbsd-9]: wsemul_vt100.c

 Log Message:
 Pull up following revision(s) (requested by gutteridge in ticket #1772):

 	sys/dev/wscons/wsemul_vt100.c: revision 1.47
 	sys/dev/wscons/wsemul_vt100.c: revision 1.48

 PR/56223: David Shao ^[]8;;^G make console unresponsive. From OpenBSD:

 In `string' state, accept bell (^G) as an end of sequence in addition to
 `ESC \', as supported by xterm; some third-party software such as
 ncmpcpp rely upon this.

 fix the NetBSD tag.


 To generate a diff of this commit:
 cvs rdiff -u -r1.45 -r1.45.4.1 src/sys/dev/wscons/wsemul_vt100.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: gutteridge@NetBSD.org
State-Changed-When: Wed, 29 Nov 2023 22:06:43 +0000
State-Changed-Why:
Pullup applied (confirmed fixed on an RPi 3B+, which also exhibited the issue). Thanks for the PR!

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.