NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/48827: libcurses issue with embedded newlines



>Number:         48827
>Category:       lib
>Synopsis:       libcurses issue with embedded newlines
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 21 13:10:01 +0000 2014
>Originator:     abs%absd.org@localhost
>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@localhost:/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




Home | Main Index | Thread Index | Old Index