NetBSD Problem Report #48827

From abs@scguk.com  Wed May 21 13:09:31 2014
Return-Path: <abs@scguk.com>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 1BAADA64ED
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 21 May 2014 13:09:31 +0000 (UTC)
Message-Id: <E1Wn4nk-00067G-RS@panix.scguk.com>
Date: Wed, 21 May 2014 12:35:16 +0100
From: abs@absd.org
Reply-To: abs@absd.org
To: gnats-bugs@gnats.NetBSD.org
Subject: libcurses issue with embedded newlines
X-Send-Pr-Version: 3.95

>Number:         48827
>Category:       lib
>Synopsis:       libcurses issue with embedded newlines
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 21 13:10:01 +0000 2014
>Closed-Date:    Tue Jun 05 11:57:50 +0000 2018
>Last-Modified:  Tue Jun 05 12:00:01 +0000 2018
>Originator:     abs@absd.org
>Release:        NetBSD 6.99.41
>Organization:

>Environment:
System: NetBSD forsaken.absd.org 6.1_STABLE NetBSD 6.1_STABLE (GENERIC) #0: Wed Apr 30 14:32:51 BST 2014 abs@cerberus.social-events.net:/var/obj/nbbuild-6-amd64/objdir/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	When sending a string with an embedded newline to addstr() curses
	appears to miscount the screen column, truncating the output as if
	the entire string was on a single line.
	eg, send a string of 60 characters, newline and another 60 characters
	the second line will be truncated around 20 characters on an 80
	character wide screen.

        On vax the symptom is more serious - the app will coredump, which
	currently includes sysinst after selecting partition size

>How-To-Repeat:
	jdc ran up a test case:

#include <curses.h>
#include <stdlib.h>

main ()
{
	if (initscr() == NULL) {
		fprintf(stderr, "Failed to initialise terminal (%s)\n",
		    getenv("TERM"));
		exit(1);
	}

	move(4, 3);
	addstr("Start  MB   End  MB  Size  MB FS type    Newfs Mount Mount point\n   --------- --------- --------- ---------- ----- ----- -----------");
        getch();

        endwin();
        exit (0);

}

>Fix:

For now a hack workaround for VAX is to add the following:
--- lib/libcurses/Makefile      21 Apr 2012 14:39:35 -0000      1.68
+++ lib/libcurses/Makefile      21 May 2014 11:28:40 -0000
@@ -176,6 +176,11 @@
         curses_touch.3 wtouchln.3 curses_underscore.3 wunderend.3 \
         curses_underscore.3 wunderscore.3 curses_line.3 wvline.3

+# sysinst crashes under gcc 4.1 after selecting partition sizes
+.if ${HAVE_GCC:U} == "4" && ${ACTIVE_CC} == "gcc" && ${MACHINE_ARCH} == "vax"
+COPTS.refresh.c+=      -fno-guess-branch-probability
+.endif
+
 .if make(install)
 SUBDIR+= PSD.doc
 .endif


>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/48827: libcurses issue with embedded newlines
Date: Wed, 21 May 2014 16:06:31 +0200

 On Wed, May 21, 2014 at 01:10:01PM +0000, abs@absd.org wrote:
 >         On vax the symptom is more serious - the app will coredump, which
 > 	currently includes sysinst after selecting partition size

 This is not the case with gcc 4.8 - vax (mis-)behaves like all other
 architectures in that case.

 Martin

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/48827: libcurses issue with embedded newlines
Date: Fri, 30 May 2014 08:17:38 +0000

 (not sent to gnats)

    ------

 From: David Brownlee <abs@absd.org>
 To: lib-bug-people@netbsd.org, "gnats-admin@netbsd.org"
 	<gnats-admin@netbsd.org>, netbsd-bugs@netbsd.org
 Subject: Re: lib/48827: libcurses issue with embedded newlines
 Date: Wed, 21 May 2014 15:03:42 +0100

 Note to revert lib/libcurses/Makefile r1.69 workaround and retest vax
 sysinst when this issue is resolved

From: "Brett Lymn" <blymn@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48827 CVS commit: src/lib/libcurses
Date: Sun, 13 Jul 2014 01:58:08 +0000

 Module Name:	src
 Committed By:	blymn
 Date:		Sun Jul 13 01:58:08 UTC 2014

 Modified Files:
 	src/lib/libcurses: addnstr.c

 Log Message:
 Remove bogus length check - SUSV2 says add(n)str wraps and performs
 special character processing so we should not be trying to limit the
 length to the screen edge.  This partially fixes PR 48827, the test case
 works now.


 To generate a diff of this commit:
 cvs rdiff -u -r1.13 -r1.14 src/lib/libcurses/addnstr.c

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

From: Brett Lymn <blymn@internode.on.net>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
        abs@absd.org
Subject: Re: lib/48827: libcurses issue with embedded newlines
Date: Sun, 13 Jul 2014 11:33:02 +0930

 On Wed, May 21, 2014 at 02:10:01PM +0000, Martin Husemann wrote:
 > 
 >  On Wed, May 21, 2014 at 01:10:01PM +0000, abs@absd.org wrote:
 >  >         On vax the symptom is more serious - the app will coredump, which
 >  > 	currently includes sysinst after selecting partition size
 >  
 >  This is not the case with gcc 4.8 - vax (mis-)behaves like all other
 >  architectures in that case.
 >  

 Can we get a useful traceback for this crash?

 I have just committed a fix for the line wrapping error.  I think the
 vax coredumping is a separate issue that we need to follow up.

 -- 
 Brett Lymn
 Let go, or be dragged - Zen proverb.

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 03 Jun 2018 21:08:58 +0000
State-Changed-Why:
Looks like the issue is fixed. Are there further issues? perhaps on vax?
(Will close the issue if no reply is received in some time, and feel free to respond saying you have no time to re-test)


State-Changed-From-To: feedback->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 05 Jun 2018 11:57:50 +0000
State-Changed-Why:
Confirmed fixed by David Brownlee also on VAX.
Thanks for the report & thanks blymn for the fix.


From: David Brownlee <abs@absd.org>
To: gnats-bugs@netbsd.org
Cc: lib-bug-people@netbsd.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, 
	maya@netbsd.org
Subject: Re: lib/48827 (libcurses issue with embedded newlines)
Date: Tue, 5 Jun 2018 12:56:07 +0100

 Can confirm issue appears to be resolved on vax (have installed netbsd
 8.0 RC1 to test)

 Thanks

 David

>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.