NetBSD Problem Report #53636

From www@NetBSD.org  Fri Sep 28 09:02:05 2018
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 9106E7A159
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 28 Sep 2018 09:02:05 +0000 (UTC)
Message-Id: <20180928090204.8EBA17A263@mollari.NetBSD.org>
Date: Fri, 28 Sep 2018 09:02:04 +0000 (UTC)
From: n54@gmx.com
Reply-To: n54@gmx.com
To: gnats-bugs@NetBSD.org
Subject: curses(3) resizeterm(3) does not ungetch(3)/unget_wch(3) KEY_RESIZE
X-Send-Pr-Version: www-1.0

>Number:         53636
>Category:       lib
>Synopsis:       curses(3) resizeterm(3) does not ungetch(3)/unget_wch(3) KEY_RESIZE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 28 09:05:00 +0000 2018
>Closed-Date:    Fri Sep 28 15:10:33 +0000 2018
>Last-Modified:  Fri Sep 28 15:10:33 +0000 2018
>Originator:     Kamil Rytarowski
>Release:        NetBSD 8.99.24 amd64
>Organization:
TNF
>Environment:
NetBSD rugged 8.99.24 NetBSD 8.99.24 (GENERIC) #8: Fri Aug 31 21:55:37 CEST 2018  root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
>Description:
resizeterm(3) shall return a character KEY_RESIZE to buffer.

KEY_RESIZE shall be generated regardless of the terminal being really resized or not (new size equals the old one).

This works well in ncurses.
>How-To-Repeat:
#include <curses.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
	int ch;

	initscr();
	resizeterm(10,10);
	ch = getch();
	endwin();

	printf("KEY_RESIZE = %s\n", ch == KEY_RESIZE ? "yes" : "no");

	return 0;
}

$ gcc test2.c -lcurses
$ ./a.out # waits infinitely for input
KEY_RESIZE = no
$ gcc test2.c -lncurses -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -I/usr/pkg/include -I/usr/pkg/include/ncurses
$ ./a.out
KEY_RESIZE = yes

>Fix:
N/A

It's not clear whether we can use ungetch(3) inside resizeterm(3), as we might want to handle a wide character variation. It might be better to emulate this.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: kamil@NetBSD.org
State-Changed-When: Fri, 28 Sep 2018 17:10:33 +0200
State-Changed-Why:
Fixed in HEAD by roy@
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libcurses/get_wch.c
cvs rdiff -u -r1.69 -r1.70 src/lib/libcurses/getch.c
cvs rdiff -u -r1.26 -r1.27 src/lib/libcurses/resize.c


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.