NetBSD Problem Report #55529

From www@netbsd.org  Sat Aug  1 07:20:44 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 36D911A9217
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  1 Aug 2020 07:20:44 +0000 (UTC)
Message-Id: <20200801072042.E01921A9218@mollari.NetBSD.org>
Date: Sat,  1 Aug 2020 07:20:42 +0000 (UTC)
From: soumendra@tamu.edu
Reply-To: soumendra@tamu.edu
To: gnats-bugs@NetBSD.org
Subject: [PATCH] script(1): Enable proper playback [-p] of curses sessions
X-Send-Pr-Version: www-1.0

>Number:         55529
>Category:       bin
>Synopsis:       [PATCH] script(1): Enable proper playback [-p] of curses sessions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 01 07:25:00 +0000 2020
>Last-Modified:  Mon Aug 03 02:45:01 +0000 2020
>Originator:     Soumendra Ganguly
>Release:        9.0
>Organization:
Texas A&M University
>Environment:
NetBSD localhost 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
The current manpage of script(1) says the following.

"Certain interactive commands, such as vi(1), create garbage in the typescript file. The script utility works best with commands that do not manipulate the screen. The results are meant to emulate a hardcopy terminal."

script(1) is currently able to record [-r] curses sessions perfectly; only the playback functionality [-p] has the above limitation when the terminal is not in raw mode; this patch removes this restriction by appropriately setting terminal attributes.

Additional notes:

. I submitted a similar patch for "scriptreplay(1)" from util-linux; it has now been merged by the maintainer of the project.

. I recently submitted a similar patch for FreeBSD script(1): https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248377

. The patch is in the form of a GitHub pull request: https://github.com/NetBSD/src/pull/14
>How-To-Repeat:
To reproduce the problem, run in a terminal that is not in raw mode. I used https://github.com/iiSeymour/game-of-life to reproduce the problem; authored by GitHub user iiSeymour, this, in the words of the author, is "a python implementation of Conway's Game of Life using the curses module with a small evolutionary twist"; it was written for Linux; therefore, one must call "python gol.py" on NetBSD to bypass the "#!".
>Fix:
I created this GitHub pull request which contains the fix: https://github.com/NetBSD/src/pull/14

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55529 CVS commit: src/usr.bin/script
Date: Sat, 1 Aug 2020 13:31:06 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sat Aug  1 17:31:06 UTC 2020

 Modified Files:
 	src/usr.bin/script: script.c

 Log Message:
 PR/55529: Soumendra Ganguly: configure the terminal in raw mode during
 playback so that output postprocessing is not done and playback of programs
 using curses does not appear corrupted.


 To generate a diff of this commit:
 cvs rdiff -u -r1.21 -r1.22 src/usr.bin/script/script.c

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

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: Christos Zoulas <christos@netbsd.org>
Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 curses sessions
Date: Sat, 1 Aug 2020 22:31:45 +0300

 On Sat, Aug 01, 2020 at 07:25:00 +0000, soumendra@tamu.edu wrote:

 > I created this GitHub pull request which contains the fix:

 At the very least this should be a command line option.  The playback
 doesn't necessarily happen on the same terminal type, so you might be
 feeding DEC commands to a WYSE terminal.  Yes, these days ~all
 emulators emulate something DEC compatible so it will most likely work
 by chance, but we still have e.g. WSEMUL_SUN in active use.

 -uwe

From: Christos Zoulas <christos@zoulas.com>
To: Valery Ushakov <uwe@stderr.spb.ru>
Cc: gnats-bugs@netbsd.org,
 Christos Zoulas <christos@netbsd.org>
Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 curses sessions
Date: Sat, 1 Aug 2020 16:13:32 -0400

 --Apple-Mail=_5EFD0B68-1738-4991-AB00-3F7ED4005485
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 This has nothing to do with the terminal type. I has to do about turning off
 output post processing on the pty so that the curses program don't end up
 with a garbled screen. Before, running vi on screen -r and using screen -p
 to play it back works fine, but things like robots garble the screen.

 christos


 --Apple-Mail=_5EFD0B68-1738-4991-AB00-3F7ED4005485
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXyXM7AAKCRBxESqxbLM7
 Ot/qAKDQe5R9HI8Tm2qA+fljKKV3fhHIBQCg4992h0UYzZSh3zWkKMve7My/avU=
 =HoKC
 -----END PGP SIGNATURE-----

 --Apple-Mail=_5EFD0B68-1738-4991-AB00-3F7ED4005485--

From: Soumendra Ganguly <soumendra@tamu.edu>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 curses sessions
Date: Sat, 1 Aug 2020 17:44:51 -0500

 Thank you for the reply! Right. But a raw mode terminal has post
 processing turned off :) That is exactly what my patch does. It sets
 the terminal to raw mode and then re-enables terminal special
 character handling.

 Thank you.
 Soumendra

 On 8/1/20, Christos Zoulas <christos@zoulas.com> wrote:
 > The following reply was made to PR bin/55529; it has been noted by GNATS.
 >
 > From: Christos Zoulas <christos@zoulas.com>
 > To: Valery Ushakov <uwe@stderr.spb.ru>
 > Cc: gnats-bugs@netbsd.org,
 >  Christos Zoulas <christos@netbsd.org>
 > Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 >  curses sessions
 > Date: Sat, 1 Aug 2020 16:13:32 -0400
 >
 >  --Apple-Mail=_5EFD0B68-1738-4991-AB00-3F7ED4005485
 >  Content-Transfer-Encoding: 7bit
 >  Content-Type: text/plain;
 >  	charset=us-ascii
 >
 >  This has nothing to do with the terminal type. I has to do about turning
 > off
 >  output post processing on the pty so that the curses program don't end up
 >  with a garbled screen. Before, running vi on screen -r and using screen -p
 >  to play it back works fine, but things like robots garble the screen.
 >
 >  christos
 >
 >
 >  --Apple-Mail=_5EFD0B68-1738-4991-AB00-3F7ED4005485
 >  Content-Transfer-Encoding: 7bit
 >  Content-Disposition: attachment;
 >  	filename=signature.asc
 >  Content-Type: application/pgp-signature;
 >  	name=signature.asc
 >  Content-Description: Message signed with OpenPGP
 >
 >  -----BEGIN PGP SIGNATURE-----
 >  Comment: GPGTools -
 > https://urldefense.com/v3/__http://gpgtools.org__;!!KwNVnqRv!U2ye45nBnFnsl_T3ukCwKbSmE_6lwP9rNYVXLmDGvIW9Ei_p4klu0D-8wl9gyMNB$
 >
 >
 >  iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXyXM7AAKCRBxESqxbLM7
 >  Ot/qAKDQe5R9HI8Tm2qA+fljKKV3fhHIBQCg4992h0UYzZSh3zWkKMve7My/avU=
 >  =HoKC
 >  -----END PGP SIGNATURE-----
 >
 >  --Apple-Mail=_5EFD0B68-1738-4991-AB00-3F7ED4005485--
 >
 >

From: Soumendra Ganguly <soumendra@tamu.edu>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 curses sessions
Date: Sat, 1 Aug 2020 17:47:42 -0500

 I understand. Ok. I will turn this into a command line option and
 resubmit. Does that work? Thank you.

 On 8/1/20, Valery Ushakov <uwe@stderr.spb.ru> wrote:
 > The following reply was made to PR bin/55529; it has been noted by GNATS.
 >
 > From: Valery Ushakov <uwe@stderr.spb.ru>
 > To: gnats-bugs@netbsd.org
 > Cc: Christos Zoulas <christos@netbsd.org>
 > Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 >  curses sessions
 > Date: Sat, 1 Aug 2020 22:31:45 +0300
 >
 >  On Sat, Aug 01, 2020 at 07:25:00 +0000, soumendra@tamu.edu wrote:
 >
 >  > I created this GitHub pull request which contains the fix:
 >
 >  At the very least this should be a command line option.  The playback
 >  doesn't necessarily happen on the same terminal type, so you might be
 >  feeding DEC commands to a WYSE terminal.  Yes, these days ~all
 >  emulators emulate something DEC compatible so it will most likely work
 >  by chance, but we still have e.g. WSEMUL_SUN in active use.
 >
 >  -uwe
 >
 >

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 soumendra@tamu.edu
Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 curses sessions
Date: Sat, 1 Aug 2020 20:06:59 -0400

 --Apple-Mail=_4D5F5F89-71A3-47E2-8322-10D561D94A0B
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 I've already committed it. Uwe can you explain why this should be an option?

 Thanks,

 christos

 > On Aug 1, 2020, at 6:50 PM, Soumendra Ganguly <soumendra@tamu.edu> wrote:
 > 
 > The following reply was made to PR bin/55529; it has been noted by GNATS.
 > 
 > From: Soumendra Ganguly <soumendra@tamu.edu>
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 > curses sessions
 > Date: Sat, 1 Aug 2020 17:47:42 -0500
 > 
 > I understand. Ok. I will turn this into a command line option and
 > resubmit. Does that work? Thank you.
 > 
 > On 8/1/20, Valery Ushakov <uwe@stderr.spb.ru> wrote:
 >> The following reply was made to PR bin/55529; it has been noted by GNATS.
 >> 
 >> From: Valery Ushakov <uwe@stderr.spb.ru>
 >> To: gnats-bugs@netbsd.org
 >> Cc: Christos Zoulas <christos@netbsd.org>
 >> Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 >> curses sessions
 >> Date: Sat, 1 Aug 2020 22:31:45 +0300
 >> 
 >> On Sat, Aug 01, 2020 at 07:25:00 +0000, soumendra@tamu.edu wrote:
 >> 
 >>> I created this GitHub pull request which contains the fix:
 >> 
 >> At the very least this should be a command line option.  The playback
 >> doesn't necessarily happen on the same terminal type, so you might be
 >> feeding DEC commands to a WYSE terminal.  Yes, these days ~all
 >> emulators emulate something DEC compatible so it will most likely work
 >> by chance, but we still have e.g. WSEMUL_SUN in active use.
 >> 
 >> -uwe
 >> 
 >> 
 > 


 --Apple-Mail=_4D5F5F89-71A3-47E2-8322-10D561D94A0B
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXyYDpAAKCRBxESqxbLM7
 OpGFAKCeBtb8nHm9XO1wD9CbklHRFyXvegCfTft4DUhGiD5dpbO1S2UX0Y5n7+M=
 =bhoy
 -----END PGP SIGNATURE-----

 --Apple-Mail=_4D5F5F89-71A3-47E2-8322-10D561D94A0B--

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: Christos Zoulas <christos@zoulas.com>
Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 curses sessions
Date: Sun, 2 Aug 2020 05:38:18 +0300

 Sorry, I have misinterprepted what's going on.  Please, ignore.

 In my defense - please, please, please, don't use github to submit
 patches.  It takes multiple clicks to find the actual patch and then
 it's "helpfully" highlighted in shades of pink and green that I
 *cannot* see b/c I have mild deuteranomaly.  I don't have problems
 with traffic lights, but modern UI designs prefer pastel shades that
 *are* a problem.  I haven't found a way to change those colors or get
 the actual diff.

 -uwe

From: Soumendra Ganguly <soumendra@tamu.edu>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 curses sessions
Date: Sat, 1 Aug 2020 22:05:58 -0500

 Sir,
    Thank you for committing the patch.

 Thank you for the suggestion. Henceforth, I will not send NetBSD
 patches using GitHub.

 Soumendra Ganguly

 On 8/1/20, Valery Ushakov <uwe@stderr.spb.ru> wrote:
 > The following reply was made to PR bin/55529; it has been noted by GNATS.
 >
 > From: Valery Ushakov <uwe@stderr.spb.ru>
 > To: gnats-bugs@netbsd.org
 > Cc: Christos Zoulas <christos@zoulas.com>
 > Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 >  curses sessions
 > Date: Sun, 2 Aug 2020 05:38:18 +0300
 >
 >  Sorry, I have misinterprepted what's going on.  Please, ignore.
 >
 >  In my defense - please, please, please, don't use github to submit
 >  patches.  It takes multiple clicks to find the actual patch and then
 >  it's "helpfully" highlighted in shades of pink and green that I
 >  *cannot* see b/c I have mild deuteranomaly.  I don't have problems
 >  with traffic lights, but modern UI designs prefer pastel shades that
 >  *are* a problem.  I haven't found a way to change those colors or get
 >  the actual diff.
 >
 >  -uwe
 >
 >

From: Thomas Klausner <tk@giga.or.at>
To: gnats-bugs@netbsd.org
Cc: uwe@NetBSD.org
Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 curses sessions
Date: Sun, 2 Aug 2020 12:53:03 +0200

 On Sun, Aug 02, 2020 at 02:40:01AM +0000, Valeriy E. Ushakov wrote:
 >  In my defense - please, please, please, don't use github to submit
 >  patches.  It takes multiple clicks to find the actual patch and then
 >  it's "helpfully" highlighted in shades of pink and green that I
 >  *cannot* see b/c I have mild deuteranomaly.  I don't have problems
 >  with traffic lights, but modern UI designs prefer pastel shades that
 >  *are* a problem.  I haven't found a way to change those colors or get
 >  the actual diff.

 That's actually quite easy, but I don't think there are links.

 For a pull request like

 https://github.com/NetBSD/src/pull/14

 just append ".diff" and it will automatically redirect to

 https://patch-diff.githubusercontent.com/raw/NetBSD/src/pull/14.diff

 which is a plain git diff.
  Thomas

From: Soumendra Ganguly <soumendra@tamu.edu>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 curses sessions
Date: Sun, 2 Aug 2020 21:40:35 -0500

 Mr. Klausner, that was very helpful. Thank you.

 On 8/2/20, Thomas Klausner <tk@giga.or.at> wrote:
 > The following reply was made to PR bin/55529; it has been noted by GNATS.
 >
 > From: Thomas Klausner <tk@giga.or.at>
 > To: gnats-bugs@netbsd.org
 > Cc: uwe@NetBSD.org
 > Subject: Re: bin/55529: [PATCH] script(1): Enable proper playback [-p] of
 >  curses sessions
 > Date: Sun, 2 Aug 2020 12:53:03 +0200
 >
 >  On Sun, Aug 02, 2020 at 02:40:01AM +0000, Valeriy E. Ushakov wrote:
 >  >  In my defense - please, please, please, don't use github to submit
 >  >  patches.  It takes multiple clicks to find the actual patch and then
 >  >  it's "helpfully" highlighted in shades of pink and green that I
 >  >  *cannot* see b/c I have mild deuteranomaly.  I don't have problems
 >  >  with traffic lights, but modern UI designs prefer pastel shades that
 >  >  *are* a problem.  I haven't found a way to change those colors or get
 >  >  the actual diff.
 >
 >  That's actually quite easy, but I don't think there are links.
 >
 >  For a pull request like
 >
 > https://urldefense.com/v3/__https://github.com/NetBSD/src/pull/14__;!!KwNVnqRv!V9888i2Ze3WpycYEO0moWXtBvsjZI4fqqF1LmN0RrULX6KbN9HYmzfHZVjN1yRGp$
 >
 >
 >  just append ".diff" and it will automatically redirect to
 >
 > https://urldefense.com/v3/__https://patch-diff.githubusercontent.com/raw/NetBSD/src/pull/14.diff__;!!KwNVnqRv!V9888i2Ze3WpycYEO0moWXtBvsjZI4fqqF1LmN0RrULX6KbN9HYmzfHZVk2CeTRH$
 >
 >
 >  which is a plain git diff.
 >   Thomas
 >
 >

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.