Bug 1034810

Summary: ncurses segfault
Product: [openSUSE] openSUSE Tumbleweed Reporter: Forgotten User bcqd5ipArz <forgotten_bcqd5ipArz>
Component: OtherAssignee: Dr. Werner Fink <werner>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: forgotten_bcqd5ipArz, malcolmlewis
Version: CurrentFlags: werner: needinfo? (forgotten_bcqd5ipArz)
Target Milestone: ---   
Hardware: x86-64   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Forgotten User bcqd5ipArz 2017-04-18 21:19:46 UTC
Trivial ncurses apps all segfault in initscr().

The following hello world program segfaults in initscr:

#include <ncurses.h>

int main()
{	
  initscr();			/* Start curses mode 		  */
  printw("Hello World !!!");	/* Print Hello World		  */
  refresh();			/* Print it on to the real screen */
  getch();			/* Wait for user input */
  endwin();			/* End curses mode		  */
  return 0;
}

So does this app:

#include <unistd.h>
#include <ncurses.h>

int main(void)
{
  initscr();
  sleep(2);
  endwin();
  return 0;
}

Those work fine on other distros (and on older versions of openSUSE)
Comment 1 Forgotten User bcqd5ipArz 2017-04-18 21:22:06 UTC
Above apps built like this (with gcc 6.3.1) and 

$ gcc -Wall -Werror -o hello hello.c -lncurses
$ ./hello 
Segmentation fault (core dumped)

When built with debug symbols and -O0:

$ gcc -Wall -Werror -O0 -g -o hello hello.c -lncurses
$ gdb ./hello
GNU gdb (GDB; openSUSE Tumbleweed) 7.12.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./hello...done.
(gdb) run
Starting program: /home/grante/lcom-1.05/hello 
Missing separate debuginfo for /lib64/ld-linux-x86-64.so.2
Try: zypper install -C "debuginfo(build-id)=07c7677d371558f84c75acc347b0d57203a11468"
Missing separate debuginfo for /lib64/libncurses.so.6
Try: zypper install -C "debuginfo(build-id)=32f879508c4d1429b772fa37779b6c23c87b8175"
Missing separate debuginfo for /lib64/libtinfo.so.6
Try: zypper install -C "debuginfo(build-id)=969236c829d945223d3eab5acb6286ff598318bb"
Missing separate debuginfo for /lib64/libc.so.6
Try: zypper install -C "debuginfo(build-id)=121b0e273a4c27c0ee4b04b771262191bf12458a"
Missing separate debuginfo for /lib64/libdl.so.2
Try: zypper install -C "debuginfo(build-id)=929d59059f4c87b260a2f28f8b53b2ff4c528200"

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7991bb2 in _nc_init_acs_sp () from /lib64/libtinfo.so.6
(gdb)
Comment 2 Forgotten User bcqd5ipArz 2017-04-18 21:29:04 UTC
$ ldd hello
	linux-vdso.so.1 (0x00007fffcc9f3000)
	libncurses.so.6 => /lib64/libncurses.so.6 (0x00007f2e3268c000)
	libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f2e32462000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f2e320bd000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f2e31eb9000)
	/lib64/ld-linux-x86-64.so.2 (0x0000563eec008000)

$ rpm -qa | grep ncurses
ncurses-utils-6.0-21.1.x86_64
libncurses6-6.0-21.1.x86_64
libyui-ncurses7-2.48.0-1.1.x86_64
libyui-ncurses-pkg7-2.48.4-1.1.x86_64
ncurses-devel-6.0-21.1.x86_64
Comment 3 Dr. Werner Fink 2017-04-24 06:18:56 UTC
Do you have checked this with the latestr ncurses from project Base:System ?

With the last change

 Thu Apr 13 13:16:58 UTC 2017 - werner@suse.de
 - With one of the latest update patches libtinfo now has become
   splitted into a normal and wide character version (boo#1033198) 

this one might be become fixed as well
Comment 4 Dr. Werner Fink 2017-04-24 06:32:29 UTC
IMHO a dub of boo#1033198
Comment 5 Dr. Werner Fink 2017-04-24 06:38:57 UTC
What is the reason for not accepting SR#487834
Comment 6 Dr. Werner Fink 2017-04-24 06:40:26 UTC
Dup boo#1033198

*** This bug has been marked as a duplicate of bug 1033198 ***