Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 692954 - sys-libs/ncurses-6.1_p20190609 - pinfo open: segmentation fault in termattrs_sp (sp=sp@entry=0x555555573770) at /usr/src/debug/sys-libs/ncurses-6.1_p20190609/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
Summary: sys-libs/ncurses-6.1_p20190609 - pinfo open: segmentation fault in termattrs_...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL: https://lists.gnu.org/archive/html/bu...
Whiteboard:
Keywords:
: 697776 707760 (view as bug list)
Depends on:
Blocks: tinfo
  Show dependency tree
 
Reported: 2019-08-27 14:15 UTC by Han Han
Modified: 2023-07-28 19:17 UTC (History)
10 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Han Han 2019-08-27 14:15:41 UTC
Execute `pinfo open`, then get a segment fault.
Version:
sys-libs/ncurses-6.1_p20190609, use flags: cxx, gpm, unicode
app-text/pinfo-0.6.13, use flags: nls, readline


Reproducible: Always

Steps to Reproduce:

emerge info:
Portage 2.3.69 (python 3.6.8-final-0, default/linux/amd64/17.0/desktop/gnome/systemd, gcc-8.2.0, glibc-2.29-r4, 5.2.0-gentoo x86_64)
=================================================================
System uname: Linux-5.2.0-gentoo-x86_64-Intel-R-_Core-TM-_i5-7300HQ_CPU_@_2.50GHz-with-gentoo-2.6
KiB Mem:    16386960 total,   9540144 free
KiB Swap:    8388604 total,   8388604 free
Timestamp of repository gentoo: Mon, 26 Aug 2019 03:30:01 +0000
Head commit of repository gentoo: 0cbc3eff02fe2fd49c010318a354a018023ec505
Head commit of repository flatpak-overlay: 7be4bb289d57839ec18ae118f830981a4bbde5bc

sh bash 5.0_p7
ld GNU ld (Gentoo 2.31.1 p5) 2.31.1
ccache version 3.7.2 [enabled]
app-shells/bash:          5.0_p7::gentoo
dev-lang/perl:            5.30.0::gentoo
dev-lang/python:          2.7.16::gentoo, 3.6.8::gentoo
dev-util/ccache:          3.7.2::gentoo
dev-util/cmake:           3.14.5::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.38.3-r1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.31.1-r4::gentoo, 2.32-r1::gentoo
sys-devel/gcc:            8.2.0-r6::gentoo, 8.3.0-r1::gentoo, 9.1.0-r1::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes

flatpak-overlay
    location: /usr/portage/flatpak-overlay
    sync-type: git
    sync-uri: https://github.com/fosero/flatpak-overlay.git
    masters: gentoo
    priority: 50

gentoo-zh
    location: /var/lib/layman/gentoo-zh
    masters: gentoo
    priority: 50

linxon
    location: /var/lib/layman/linxon
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/i2pd/certificates"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -ggdb"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs ccache compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles installsources ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://mirrors.163.com/gentoo/ http://mirrors.163.com/gentoo/ https://mirrors.tuna.tsinghua.edu.cn/gentoo"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cli colord crypt cups cxx dbus debugsyms dri dts dvd dvdr eds emboss encode evo exif fam flac fortran gdbm gif glamor gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk iconv icu installsources introspection ipv6 jpeg lcms ldap libnotify libsecret libtirpc mad mng mp3 mp4 mpeg multilib nautilus ncurses networkmanager nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio readline sdl seccomp spell split-usr ssl startup-notification svg systemd tcpd tiff tracker truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


Steps:
$ pinfo open
Caught signal 11, bye!
pinfo: crash with: Success

backtrace:
(gdb) bt
#0  0x00007ffff7f26349 in termattrs_sp (sp=sp@entry=0x555555573770) at /usr/src/debug/sys-libs/ncurses-6.1_p20190609/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
#1  0x00007ffff7f236bf in _nc_setupscreen_sp (spp=spp@entry=0x7fffffffc6e8, slines=<optimized out>, scolumns=<optimized out>, output=output@entry=0x555555572420, filtered=<optimized out>, 
    slk_format=slk_format@entry=0) at /usr/src/debug/sys-libs/ncurses-6.1_p20190609/ncurses-6.1/ncurses/base/lib_set_term.c:507
#2  0x00007ffff7f1ee4e in newterm_sp (sp=<optimized out>, name=name@entry=0x0, ofp=ofp@entry=0x555555572420, ifp=ifp@entry=0x555555572420)
    at /usr/src/debug/sys-libs/ncurses-6.1_p20190609/ncurses-6.1/ncurses/base/lib_newterm.c:222
#3  0x00007ffff7f1f2d8 in newterm (name=name@entry=0x0, ofp=0x555555572420, ifp=0x555555572420) at /usr/src/debug/sys-libs/ncurses-6.1_p20190609/ncurses-6.1/ncurses/base/lib_newterm.c:355
#4  0x0000555555565244 in init_curses () at utils.c:410
#5  0x00005555555615f5 in handlemanual (name=0x7fffffffda50 "open") at manual.c:294
#6  0x0000555555557f53 in main (argc=2, argv=0x7fffffffdc78) at pinfo.c:312


Actual Results:  
As above

Expected Results:  
No segment fault

I have configured  and make ncurses-6.1 with patch-6.1-20190609.sh.gz by following configurations:
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --with-terminfo-dirs=/etc/terminfo:/usr/share/terminfo --enable-pc-files --with-pkg-config-libdir=/usr/lib64/pkgconfig --with-shared --without-hashed-db --without-ada --with-cxx --with-cxx-binding --with-cxx-shared --without-debug --without-profile --with-gpm=libgpm.so.1 --disable-term-driver --disable-termcap --enable-symlinks --with-rcs-ids --with-manpage-format=normal --enable-const --enable-colorfgbg --enable-hard-tabs --enable-echo --enable-warnings --without-assertions --enable-leaks --without-expanded --with-macros --with-progs --without-tests --without-trace --with-termlib --disable-stripping --disable-widec --without-pthread --without-reentrant --enable-overwrite

And then execute pinfo as:
$ LD_PRELOAD="$(find . -name '*so\.*'|tr '\n' ' ')" pinfo open

Not reproduced the bug
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2019-08-27 17:27:00 UTC
Seems to be related to your locale settings. Could you share those, please?
Comment 2 Han Han 2019-08-31 08:33:21 UTC
(In reply to Jeroen Roovers from comment #1)
> Seems to be related to your locale settings. Could you share those, please?

LANG=en_US.utf8
LC_CTYPE=en_US.utf8
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2019-09-07 07:26:33 UTC
Well, that's odd. I am seeing the exact same problem with a different program (ncmpcpp) and a different version of ncurses now.

=sys-libs/ncurses-6.1_p20181020

Reading symbols from ncmpcpp...
Reading symbols from /usr/lib/debug//usr/bin/ncmpcpp.debug...
(gdb) run
Starting program: /usr/bin/ncmpcpp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Reading configuration from /home/jeroen/.ncmpcpp/config...

Program received signal SIGSEGV, Segmentation fault.
0xb7764dff in termattrs_sp (sp=0x6ddfb0) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
381     /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c: No such file or directory.
(gdb) where
#0  0xb7764dff in termattrs_sp (sp=0x6ddfb0) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
#1  termattrs_sp (sp=sp@entry=0x6ddfb0) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:370
#2  0xb77618a6 in _nc_setupscreen_sp (spp=spp@entry=0xbfffdccc, slines=<optimized out>, scolumns=<optimized out>, output=0xb73a7d80 <_IO_2_1_stdout_>,
    filtered=0, slk_format=slk_format@entry=0) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_set_term.c:507
#3  0xb775cc78 in newterm_sp (sp=<optimized out>, name=name@entry=0xbffff6f5 "screen", ofp=ofp@entry=0xb73a7d80 <_IO_2_1_stdout_>,
    ifp=ifp@entry=0xb73a75c0 <_IO_2_1_stdin_>) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:222
#4  0xb775d116 in newterm (name=name@entry=0xbffff6f5 "screen", ofp=0xb73a7d80 <_IO_2_1_stdout_>, ifp=0xb73a75c0 <_IO_2_1_stdin_>)
    at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:355
#5  0xb775831d in initscr () at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_initscr.c:89
#6  0x00459585 in NC::initScreen (enable_colors=true, enable_mouse=false) at curses/window.cpp:390
#7  0x00449aab in main (argc=1, argv=0xbfffea84) at ncmpcpp.cpp:116

I can also reproduce it with pinfo:

Starting program: /usr/bin/pinfo
Przemek's Info Viewer v0.6.13
[Detaching after vfork from child process 12257]
[Detaching after vfork from child process 12259]
[Detaching after vfork from child process 12261]

Program received signal SIGSEGV, Segmentation fault.
0xb7f52dff in termattrs_sp (sp=0x421610) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
381     /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c: No such file or directory.
(gdb) where
#0  0xb7f52dff in termattrs_sp (sp=0x421610) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
#1  termattrs_sp (sp=sp@entry=0x421610) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:370
#2  0xb7f4f8a6 in _nc_setupscreen_sp (spp=spp@entry=0xbfffe80c, slines=<optimized out>, scolumns=<optimized out>, output=0x41fae0, filtered=0,
    slk_format=slk_format@entry=0) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_set_term.c:507
#3  0xb7f4ac78 in newterm_sp (sp=<optimized out>, name=name@entry=0x0, ofp=ofp@entry=0x41fae0, ifp=ifp@entry=0x41fae0)
    at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:222
#4  0xb7f4b116 in newterm (name=name@entry=0x0, ofp=0x41fae0, ifp=0x41fae0)
    at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:355
#5  0x004117ab in init_curses () at utils.c:410
#6  0x004024dc in main (argc=<optimized out>, argv=0xbfffeb44) at pinfo.c:375

What has changed?
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2019-09-07 08:09:15 UTC
Could it be a problem that these programs load two different tinfo libraries?

# lddtree /usr/bin/pinfo
pinfo => /usr/bin/pinfo (interpreter => /lib/ld-linux.so.2)
    libreadline.so.7 => /lib/libreadline.so.7
        libtinfo.so.6 => /lib/libtinfo.so.6
    libncursesw.so.6 => /lib/libncursesw.so.6
        libdl.so.2 => /lib/libdl.so.2
            ld-linux.so.2 => /lib/ld-linux.so.2
        libtinfow.so.6 => /lib/libtinfow.so.6
    libc.so.6 => /lib/libc.so.6


# lddtree /usr/bin/ncmpcpp
ncmpcpp => /usr/bin/ncmpcpp (interpreter => /lib/ld-linux.so.2)
    libboost_filesystem.so.1.65.0 => /usr/lib/libboost_filesystem.so.1.65.0
        librt.so.1 => /lib/librt.so.1
    libboost_locale.so.1.65.0 => /usr/lib/libboost_locale.so.1.65.0
        libboost_chrono.so.1.65.0 => /usr/lib/libboost_chrono.so.1.65.0
        libicudata.so.64 => /usr/lib/libicudata.so.64
    libboost_program_options.so.1.65.0 => /usr/lib/libboost_program_options.so.1.65.0
    libboost_regex.so.1.65.0 => /usr/lib/libboost_regex.so.1.65.0
    libboost_thread.so.1.65.0 => /usr/lib/libboost_thread.so.1.65.0
    libboost_system.so.1.65.0 => /usr/lib/libboost_system.so.1.65.0
    libicui18n.so.64 => /usr/lib/libicui18n.so.64
        libm.so.6 => /lib/libm.so.6
            ld-linux.so.2 => /lib/ld-linux.so.2
    libicuuc.so.64 => /usr/lib/libicuuc.so.64
        libdl.so.2 => /lib/libdl.so.2
    libmpdclient.so.2 => /usr/lib/libmpdclient.so.2
    libreadline.so.7 => /lib/libreadline.so.7
        libtinfo.so.6 => /lib/libtinfo.so.6
    libpthread.so.0 => /lib/libpthread.so.0
    libncursesw.so.6 => /lib/libncursesw.so.6
        libtinfow.so.6 => /lib/libtinfow.so.6
    libcurl.so.4 => /usr/lib/libcurl.so.4
        libidn2.so.0 => /usr/lib/libidn2.so.0
            libunistring.so.2 => /usr/lib/libunistring.so.2
        libssl.so.1.1 => /usr/lib/libssl.so.1.1
        libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1
        libz.so.1 => /lib/libz.so.1
    libtag.so.1 => /usr/lib/libtag.so.1
    libstdc++.so.6 => /usr/lib/gcc/i686-pc-linux-gnu/8.3.0/libstdc++.so.6
    libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/8.3.0/libgcc_s.so.1
    libc.so.6 => /lib/libc.so.6

In both cases libtinfo is loaded through libreadline, and libtinfow is loaded through libncursesw.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2019-09-07 08:35:52 UTC
(In reply to Jeroen Roovers from comment #4)
> Could it be a problem that these programs load two different tinfo libraries?

[...]

> In both cases libtinfo is loaded through libreadline, and libtinfow is
> loaded through libncursesw.

And also gdb itself:

$ lddtree /usr/bin/gdb
gdb => /usr/bin/gdb (interpreter => /lib/ld-linux.so.2)
    libreadline.so.7 => /lib/libreadline.so.7
        libtinfo.so.6 => /lib/libtinfo.so.6
    libz.so.1 => /lib/libz.so.1
    libncursesw.so.6 => /lib/libncursesw.so.6
        libtinfow.so.6 => /lib/libtinfow.so.6
    libdl.so.2 => /lib/libdl.so.2
    libpython3.6m.so.1.0 => /usr/lib/libpython3.6m.so.1.0
        libutil.so.1 => /lib/libutil.so.1
    libpthread.so.0 => /lib/libpthread.so.0
    libm.so.6 => /lib/libm.so.6
    libexpat.so.1 => /usr/lib/libexpat.so.1
    liblzma.so.5 => /lib/liblzma.so.5
    libmpfr.so.4 => /usr/lib/libmpfr.so.4
        libgmp.so.10 => /usr/lib/libgmp.so.10
    libc.so.6 => /lib/libc.so.6
    ld-linux.so.2 => /lib/ld-linux.so.2
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2019-09-16 06:31:41 UTC
After rebuilding sys-libs/ncurses with -O0:

$ gdb ncmpcpp
GNU gdb (Gentoo 8.3 vanilla) 8.3
Copyright (C) 2019 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 "i686-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.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 ncmpcpp...
Reading symbols from /usr/lib/debug//usr/bin/ncmpcpp.debug...
(gdb) run
Starting program: /usr/bin/ncmpcpp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Reading configuration from /home/jeroen/.ncmpcpp/config...
Terminal doesn't support window title, skipping 'enable_window_title'.

Program received signal SIGSEGV, Segmentation fault.
0xb7761205 in termattrs_sp (sp=0x6ddf90) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
381     /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c: No such file or directory.
(gdb) where
#0  0xb7761205 in termattrs_sp (sp=0x6ddf90) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
#1  0xb775d2f9 in _nc_setupscreen_sp (spp=0xbfffdccc, slines=55, scolumns=159, output=0xb739fd80 <_IO_2_1_stdout_>, filtered=0, slk_format=0)
    at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_set_term.c:507
#2  0xb7756db0 in newterm_sp (sp=0x6ddf90, name=0xbffff6df "linux", ofp=0xb739fd80 <_IO_2_1_stdout_>, ifp=0xb739f5c0 <_IO_2_1_stdin_>)
    at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:222
#3  0xb77571d2 in newterm (name=0xbffff6df "linux", ofp=0xb739fd80 <_IO_2_1_stdout_>, ifp=0xb739f5c0 <_IO_2_1_stdin_>)
    at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:355
#4  0xb7751498 in initscr () at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_initscr.c:89
#5  0x00459585 in NC::initScreen (enable_colors=true, enable_mouse=false) at curses/window.cpp:390
#6  0x00449aab in main (argc=1, argv=0xbfffea74) at ncmpcpp.cpp:116
(gdb) t a a bt full

Thread 1 (Thread 0xb5121700 (LWP 12048)):
#0  0xb7761205 in termattrs_sp (sp=0x6ddf90) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
        attrs = 0
#1  0xb775d2f9 in _nc_setupscreen_sp (spp=0xbfffdccc, slines=55, scolumns=159, output=0xb739fd80 <_IO_2_1_stdout_>, filtered=0, slk_format=0) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_set_term.c:507
        null_TTY = {c_iflag = 0, c_oflag = 0, c_cflag = 0, c_lflag = 0, c_line = 0 '\000', c_cc = '\000' <repeats 31 times>, c_ispeed = 0, c_ospeed = 0}
        env = 0x0
        bottom_stolen = 0
        sp = 0x6ddf90
        support_cookies = false
#2  0xb7756db0 in newterm_sp (sp=0x6ddf90, name=0xbffff6df "linux", ofp=0xb739fd80 <_IO_2_1_stdout_>, ifp=0xb739f5c0 <_IO_2_1_stdin_>) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:222
        slk_format = 0
        filter_mode = 0
        errret = 1
        result = 0x0
        current = 0x0
        its_term = 0x0
        _ofp = 0xb739fd80 <_IO_2_1_stdout_>
        _ifp = 0xb739f5c0 <_IO_2_1_stdin_>
        new_term = 0x0
#3  0xb77571d2 in newterm (name=0xbffff6df "linux", ofp=0xb739fd80 <_IO_2_1_stdout_>, ifp=0xb739f5c0 <_IO_2_1_stdin_>) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:355
        rc = 0xb7757178 <newterm>
#4  0xb7751498 in initscr () at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_initscr.c:89
        name = 0xbffff6df "linux"
        result = 0xb775141b <initscr>
#5  0x00459585 in NC::initScreen (enable_colors=true, enable_mouse=false) at curses/window.cpp:390
        abort_prompt = <optimized out>
#6  0x00449aab in main (argc=1, argv=0xbfffea74) at ncmpcpp.cpp:116
        __PRETTY_FUNCTION__ = "int main(int, char**)"
        key_pressed = <optimized out>
        input = 0
        connect_attempt = <optimized out>
        update_environment = {<Actions::BaseAction> = {_vptr.BaseAction = 0x10001, m_name = <error: Cannot access memory at address 0x10001>, m_type = 65537},
m_past = {<boost::date_time::base_time<boost::posix_time::ptime, boost::date_time::counted_time_system<boost::date_time::counted_time_rep<boost::posix_time::millisec_posix_time_system_config> > >> = {<boost::operators_impl::less_than_comparable<boost::posix_time::ptime, boost::operators_impl::equality_comparable<boost::posix_time::ptime, boost::posix_time::ptime, boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>, boost::operators_impl::operators_detail::false_t>, boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>, boost::operators_impl::operators_detail::true_t>> = {<boost::operators_impl::less_than_comparable1<boost::posix_time::ptime, boost::operators_impl::equality_comparable<boost::posix_time::ptime, boost::posix_time::ptime,
boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>, boost::operators_impl::operators_detail::false_t> >> = {<boost::operators_impl::equality_comparable<boost::posix_time::ptime, boost::posix_time::ptime, boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>, boost::operators_impl::operators_detail::false_t>> = {<boost::operators_impl::equality_comparable1<boost::posix_time::ptime, boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime> >> = {<boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, time_ = {time_count_ = {value_ = -4611712644137671714}}}, <No data fields>}}
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2019-09-16 06:38:26 UTC
$ gdb pinfo
GNU gdb (Gentoo 8.3 vanilla) 8.3
Copyright (C) 2019 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 "i686-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.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 pinfo...
Reading symbols from /usr/lib/debug//usr/bin/pinfo.debug...
(gdb) run open
Starting program: /usr/bin/pinfo open
Przemek's Info Viewer v0.6.13
[Detaching after vfork from child process 12185]
[Detaching after vfork from child process 12187]
[Detaching after vfork from child process 12189]
Error: could not open info file, trying manual

Program received signal SIGSEGV, Segmentation fault.
0xb7f4f205 in termattrs_sp (sp=0x41ed00) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
381     /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c: No such file or directory.
(gdb) where
#0  0xb7f4f205 in termattrs_sp (sp=0x41ed00) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
#1  0xb7f4b2f9 in _nc_setupscreen_sp (spp=0xbfffd57c, slines=55, scolumns=159, output=0x41dae0, filtered=0, slk_format=0)
    at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_set_term.c:507
#2  0xb7f44db0 in newterm_sp (sp=0x41ed00, name=0x0, ofp=0x41dae0, ifp=0x41dae0)
    at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:222
#3  0xb7f451d2 in newterm (name=name@entry=0x0, ofp=0x41dae0, ifp=0x41dae0)
    at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:355
#4  0x004117ab in init_curses () at utils.c:410
#5  0x0040d04b in handlemanual (name=0xbfffe8ac "open") at manual.c:294
#6  0x00403385 in main (argc=<optimized out>, argv=0xbfffea74) at pinfo.c:312
(gdb) t a a bt full

Thread 1 (process 12181):
#0  0xb7f4f205 in termattrs_sp (sp=0x41ed00) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/tty/lib_vidattr.c:381
        attrs = 0
#1  0xb7f4b2f9 in _nc_setupscreen_sp (spp=0xbfffd57c, slines=55, scolumns=159, output=0x41dae0, filtered=0, slk_format=0) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_set_term.c:507
        null_TTY = {c_iflag = 0, c_oflag = 0, c_cflag = 0, c_lflag = 0, c_line = 0 '\000', c_cc = '\000' <repeats 31 times>, c_ispeed = 0, c_ospeed = 0}
        env = 0x0
        bottom_stolen = 0
        sp = 0x41ed00
        support_cookies = false
#2  0xb7f44db0 in newterm_sp (sp=0x41ed00, name=0x0, ofp=0x41dae0, ifp=0x41dae0) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:222
        slk_format = 0
        filter_mode = 0
        errret = 1
        result = 0x0
        current = 0x0
        its_term = 0x0
        _ofp = 0x41dae0
        _ifp = 0x41dae0
        new_term = 0x0
#3  0xb7f451d2 in newterm (name=name@entry=0x0, ofp=0x41dae0, ifp=0x41dae0) at /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1/ncurses/base/lib_newterm.c:355
        rc = 0xb7f45178 <newterm>
#4  0x004117ab in init_curses () at utils.c:410
        f = <optimized out>
        screen = <optimized out>
#5  0x0040d04b in handlemanual (name=0xbfffe8ac "open") at manual.c:294
        return_value = 0
        statbuf = {st_dev = 0, __pad1 = 0, st_ino = 0, st_mode = 0, st_nlink = 0, st_uid = 0, st_gid = 0, st_rdev = 0, __pad2 = 0, st_size = 0, st_blksize = 0, st_blocks = 0, st_atim = {tv_sec = 0, tv_nsec = 0}, st_mtim = {tv_sec = 0, tv_nsec = 0}, st_ctim = {tv_sec = 0, tv_nsec = 0}, __glibc_reserved4 = 0, __glibc_reserved5 = 0}
        id = <optimized out>
        manualname = '\000' <repeats 12 times>, "\256\256\356\267\360\257\341\267\000\000\000\000\254\332\377\277\020\331\377\277\004\000\000\000\200\352\377\277", '\000' <repeats 92 times>, "\200\327\377\277\000\000\000\000t\327\377\277\347u\327\267", '\000' <repeats 12 times>, "`v\362\267", '\000' <repeats 48 times>...
        cmd = "\tI䷬\332\377\277\000\000\000\000\000\000\000\000\354\330\377\277Y\251\332\377\277\020\331\377\277\200\352\377\277\000\000\000\000\360\257\352\377\277", '\000' <repeats 12 times>, " \331\377\277\060x\327\267", '\000' <repeats 28 times>, "\020R\344\267\000\000\000\000\000\000\000\000\254\332\377\277\020\331\377\277", '\000' <repeats 13 times>, "\224\256\016\000\000\000\000\000\000\000\000\tI䷬\332\377\277\000\000\000\000\000\000\000\000\354\330\377\277Y\251\332\377\277\020\331\377\277\200\352\377\277\000\000\000\000\360\257\352\377\277\000\000\000\000\000\224\256\016", '\000' <repeats 13 times>, "\224\256\016\354"...
        apropos_tempfilename = 0x0
#6  0x00403385 in main (argc=<optimized out>, argv=0xbfffea74) at pinfo.c:312
        filenotfound = 0
        filename = "open", '\000' <repeats 204 times>...
        work_return_value = {node = 0x0, file = 0x0}
        i = <optimized out>
        userdefinedrc = <optimized out>
        command_line_option = <optimized out>
        id = 0x0
        lines = 538
        message = 0x4be610
        type = 0x41fd10 "File: dir,\tNode: Top\tThis is the top of the INFO tree\n"
        tag_table_pos = 1
        file_name_force = 0x0
        long_options = {{name = 0x4153f8 "help", has_arg = 0, flag = 0x0, val = 104}, {name = 0x4153fd "version", has_arg = 0, flag = 0x0, val = 118}, {name =
0x415405 "manual", has_arg = 0, flag = 0x0, val = 109}, {name = 0x415e30 "file", has_arg = 0, flag = 0x0, val = 102}, {name = 0x41540c "raw-filename", has_arg
= 0, flag = 0x0, val = 114}, {name = 0x41541f "apropos", has_arg = 0, flag = 0x0, val = 97}, {name = 0x415419 "plain-apropos", has_arg = 0, flag = 0x0, val = 112}, {name = 0x415427 "cut-man-headers", has_arg = 0, flag = 0x0, val = 99}, {name = 0x415437 "squeeze-manlines", has_arg = 0, flag = 0x0, val = 115}, {name =
0x415448 "dont-handle-without-tag-table", has_arg = 0, flag = 0x0, val = 100}, {name = 0x415466 "force-manual-tag-table", has_arg = 0, flag = 0x0, val = 116},
{name = 0x41547d "node", has_arg = 1, flag = 0x0, val = 110}, {name = 0x415482 "long-manual-links", has_arg = 0, flag = 0x0, val = 108}, {name = 0x415494 "clear-at-exit", has_arg = 0, flag = 0x0, val = 120}, {name = 0x415372 "rcfile", has_arg = 1, flag = 0x0, val = 1}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2019-09-16 07:41:55 UTC
Neither show segmentation faults when I set LD_PRELOAD='/lib/libncurses.so.6.1' while both are linked to libncursesw. Obviously that does corrupt text output.
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2019-09-16 08:02:37 UTC
Ah, with --as-needed it seems libtinfo linkage is removed whereas it does provide functions that libncurses needs. Calling 

LD_PRELOAD='/lib/libtinfow.so.6.1' pinfo open

and 

LD_PRELOAD='/lib/libtinfow.so.6.1' ncmpcpp

both work fine.
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2019-09-16 08:23:48 UTC
Han Han: Looks like your best bet would be to re-emerge everything that depends on sys-libs/ncurses. Doing that for app-text/pinfo does seem to work.

base-system: Generally I don't see another way to resolve this problem: libncurses resolves the external symbols that are needed but (internal) functions that are now part of libtinfo appear to be noops and fail to set up the terminal properly, causing segmentation faults for terminal capabilities.
Comment 11 Jeroen Roovers (RETIRED) gentoo-dev 2019-10-15 16:52:29 UTC
*** Bug 697776 has been marked as a duplicate of this bug. ***
Comment 12 Leho Kraav (:macmaN @lkraav) 2020-01-06 07:53:59 UTC
Yeah, add `app-misc/abook` to this list.

Definitely seems like something with ncurses rebuild.
Comment 13 Jeroen Roovers (RETIRED) gentoo-dev 2020-02-01 13:20:30 UTC
*** Bug 707760 has been marked as a duplicate of this bug. ***
Comment 14 Vladimir Vrzić 2020-02-18 01:49:32 UTC
Also app-misc/gtypist, proposed patch in #707760
Comment 15 Frederik Pfautsch 2020-05-06 22:24:41 UTC
Also in app-cdr/cdw, however while upstream is correct, the ebuilds add the additional linkage to ncurses instead ncursesw (src_configure). Works after changing it to ncursesw.
Comment 16 Beelzebubbie 2020-07-13 15:53:53 UTC
Same for ftptop from net-ftp/proftpd (1.3.7_rc3@07/13/20) and sys-libs/ncurses (6.2-r1(0/6)@07/13/20)

«Fixed» with LD_PRELOAD='/lib/libtinfow.so.6.2' ftptop
Comment 17 Sebastian Pipping gentoo-dev 2023-07-07 15:12:25 UTC
If(!) this is the same thing, it also affects musickube [1] which has an ebuild in Guru [2] and a related patch [3].  The upstream issues are [4] and [5].


[1] https://github.com/clangen/musikcube
[2] https://github.com/gentoo/guru/tree/master/media-sound/musikcube
[3] https://github.com/gentoo/guru/blob/master/media-sound/musikcube/files/musikcube-3.0.1-tinfow.patch
[4] https://github.com/clangen/musikcube/issues/588
[5] https://github.com/clangen/musikcube/issues/610