Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 699972 - net-im/mcabber with sys-libs/ncurses-6.1_p20181020 segfaults in /lib64/libncursesw.so.6 after upgrade of gcc to 9.2.0-r2
Summary: net-im/mcabber with sys-libs/ncurses-6.1_p20181020 segfaults in /lib64/libncu...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Andriy Utkin (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2019-11-13 02:09 UTC by plastyc
Modified: 2019-12-31 00:50 UTC (History)
1 user (show)

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


Attachments
output of emerge --info (emerge--info.txt,6.71 KB, text/plain)
2019-11-13 02:09 UTC, plastyc
Details
output of emerge --info net-im/mcabber (mcabber--info.txt,7.62 KB, text/plain)
2019-11-13 02:11 UTC, plastyc
Details
output of emerge --info sys-libs/ncurses (ncurses--info.txt,7.19 KB, text/plain)
2019-11-13 02:12 UTC, plastyc
Details
output of emerge --info sys-devel/gcc (gcc--info.txt,7.66 KB, text/plain)
2019-11-13 02:14 UTC, plastyc
Details
mcabber-1.1.0-tinfow.patch (mcabber-1.1.0-tinfow.patch,3.78 KB, patch)
2019-11-13 08:57 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
failed mcabber emerge build log (build.log.tar.gz,3.67 KB, text/plain)
2019-11-13 17:55 UTC, plastyc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description plastyc 2019-11-13 02:09:51 UTC
Created attachment 595926 [details]
output of emerge --info

GDB debug:

$ gdb -q mcabber                                                                                                                                                                              
Reading symbols from mcabber...
Reading symbols from /usr/lib/debug//usr/bin/mcabber.debug...
(gdb) run
Starting program: /usr/bin/mcabber 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
MCabber 1.1.0 -- Email: mcabber [at] lilotux [dot] net
[02:56:07] MCabber 1.1.0 -- Email: mcabber [at] lilotux [dot] net

[02:56:07] Reading /home/plastyc/.mcabber/mcabberrc
[02:56:07] Server: ***
[02:56:07] User JID: ***@***

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7db7280 in _nc_setupscreen_sp () from /lib64/libncursesw.so.6
(gdb) bt
#0  0x00007ffff7db7280 in _nc_setupscreen_sp () at /lib64/libncursesw.so.6
#1  0x00007ffff7db2bdc in newterm_sp () at /lib64/libncursesw.so.6
#2  0x00007ffff7db3059 in newterm () at /lib64/libncursesw.so.6
#3  0x00007ffff7daeab4 in initscr () at /lib64/libncursesw.so.6
#4  0x0000555555576949 in scr_init_curses () at screen.c:808
#5  0x000055555556398f in main (argc=<optimized out>, argv=<optimized out>) at main.c:494

Observation:

mcabber worked correctly before upgrade of gcc to sys-devel/gcc-9.2.0-r2 (from 
sys-devel/gcc-8.3.0-r1) and recompilation of sys-libs/ncurses-6.1_p20181020 with gcc-9.2

Info (terminal rxvt-unicode):

$gcc-config -l                                                                                                                                                                    
 [1] x86_64-pc-linux-gnu-9.2.0 *
$echo $TERM                                                                                                                                                                           
rxvt
Comment 1 plastyc 2019-11-13 02:11:54 UTC
Created attachment 595928 [details]
output of emerge --info net-im/mcabber
Comment 2 plastyc 2019-11-13 02:12:55 UTC
Created attachment 595930 [details]
output of emerge --info sys-libs/ncurses
Comment 3 plastyc 2019-11-13 02:14:16 UTC
Created attachment 595932 [details]
output of emerge --info sys-devel/gcc
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2019-11-13 08:29:10 UTC
I think the bug here is that mcabber mixes wide and non-wide libraries in the same binary:

$ lddtree /usr/bin/mcabber  | egrep 'ncurses|tinfo'
        libtinfow.so.6 => /lib64/libtinfow.so.6
    libncursesw.so.6 => /lib64/libncursesw.so.6
    libtinfo.so.6 => /lib64/libtinfo.so.6

It should link consistently with libtinfow.so.6.

Similar bug in gdb: https://bugs.gentoo.org/649704
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2019-11-13 08:32:47 UTC
Looking at mcabber's configure.ac it will have to learn to find tinfow variant:

AC_CHECK_FUNC(initscr,,
[
    cf_ncurses="ncurses"
    for lib in ncursesw ncurses
    do
        AC_CHECK_LIB($lib, waddnwstr,
            [cf_ncurses="$lib"; cf_ncurses_unicode="yes"; break])
    done
    AC_CHECK_LIB($cf_ncurses, initscr,
        [LIBS="$LIBS -l$cf_ncurses"

         AC_CHECK_LIB(tinfo, tgetent, [LIBS="$LIBS -ltinfo"]) <<<---

         if test "$cf_ncurses" = ncursesw; then
            AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/panel.h],,
                 [AC_CHECK_HEADERS([ncurses.h panel.h],,
                                   AC_MSG_ERROR([Missing header file]))])
         else
             AC_CHECK_HEADERS([ncurses/ncurses.h ncurses/panel.h],,
                 [AC_CHECK_HEADERS([ncurses.h panel.h],,
                                   AC_MSG_ERROR([Missing header file]))])
         fi
        ],
        [CF_CURSES_LIBS])
])
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2019-11-13 08:57:46 UTC
Created attachment 595948 [details, diff]
mcabber-1.1.0-tinfow.patch

Try the following patch. Should be enough to drop it to /etc/portage/patches/net-im/mcabber/ and rebuild mcabber.
Comment 7 plastyc 2019-11-13 17:51:01 UTC
(In reply to Sergei Trofimovich from comment #6)
> Created attachment 595948 [details, diff] [details, diff]
> mcabber-1.1.0-tinfow.patch
> 
> Try the following patch. Should be enough to drop it to
> /etc/portage/patches/net-im/mcabber/ and rebuild mcabber.

I've tried to apply the patch, but emerge failed on missing aclocal-1.14
(build log attached):

>>> Source configured.
>>> Compiling source in /var/tmp/portage/net-im/mcabber-1.1.0-r1/work/mcabber-1.1.0 ...
make -j5 
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /var/tmp/portage/net-im/mcabber-1.1.0-r1/work/mcabber-1.1.0/missing aclocal-1.14 -I macros
/var/tmp/portage/net-im/mcabber-1.1.0-r1/work/mcabber-1.1.0/missing: line 81: aclocal-1.14: command not found
WARNING: 'aclocal-1.14' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
make: *** [Makefile:413: aclocal.m4] Error 127
 * ERROR: net-im/mcabber-1.1.0-r1::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=net-im/mcabber-1.1.0-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=net-im/mcabber-1.1.0-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/net-im/mcabber-1.1.0-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/net-im/mcabber-1.1.0-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/net-im/mcabber-1.1.0-r1/work/mcabber-1.1.0'
 * S: '/var/tmp/portage/net-im/mcabber-1.1.0-r1/work/mcabber-1.1.0'

It seems there is a hardcoded version of automake in configure (line 2451):

am__api_version='1.14'

I do have only versions 1.13.4-r2 and 1.16.1-r1. So, I've installed also 
=sys-devel/automake-1.14.1-r2 and the emerge finished successfully then.
Mcabber no longer segfaults. Also linking looks OK now:

lddtree /usr/bin/mcabber  | egrep 'ncurses|tinfo'
    libncursesw.so.6 => /lib64/libncursesw.so.6
    libtinfow.so.6 => /lib64/libtinfow.so.6

Thank you! :)

I am wondering why emerge of mcabber without patching worked and with patching it failed as I don't see any connection of the patch with automake version. Also, it seems this bug doesn't have anything in common with gcc version.
Comment 8 plastyc 2019-11-13 17:55:14 UTC
Created attachment 596014 [details]
failed mcabber emerge build log
Comment 9 Andriy Utkin (RETIRED) gentoo-dev 2019-11-20 19:05:24 UTC
Thanks plastyc, slyfox!

Raised upstream bug https://bitbucket.org/McKael/mcabber-crew/issues/166/runtime-crash-caused-by-inconsistence-in .
Comment 10 Andriy Utkin (RETIRED) gentoo-dev 2019-11-25 22:35:45 UTC
Patch applied upstream.
Figuring out upstream's plans on releasing soon.
Comment 11 Larry the Git Cow gentoo-dev 2019-12-31 00:48:49 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=583e7f0f0b3dad688c4ba2bdce64ecdf0da417dd

commit 583e7f0f0b3dad688c4ba2bdce64ecdf0da417dd
Author:     Andrey Utkin <andrey_utkin@gentoo.org>
AuthorDate: 2019-12-31 00:30:10 +0000
Commit:     Andrey Utkin <andrey_utkin@gentoo.org>
CommitDate: 2019-12-31 00:47:57 +0000

    net-im/mcabber: patch bug 699972
    
    Bug: https://bugs.gentoo.org/699972
    Package-Manager: Portage-2.3.66, Repoman-2.3.16
    Signed-off-by: Andrey Utkin <andrey_utkin@gentoo.org>

 net-im/mcabber/Manifest                | 1 +
 net-im/mcabber/mcabber-1.1.0-r2.ebuild | 8 ++++++++
 2 files changed, 9 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1332a8d46f2b52296e9bcb79242bdd6c3d8b7dc1

commit 1332a8d46f2b52296e9bcb79242bdd6c3d8b7dc1
Author:     Andrey Utkin <andrey_utkin@gentoo.org>
AuthorDate: 2019-12-30 22:44:40 +0000
Commit:     Andrey Utkin <andrey_utkin@gentoo.org>
CommitDate: 2019-12-31 00:47:53 +0000

    net-im/mcabber: add new revision 1.1.0-r2
    
    Cloned from 9999.
    To address a bug in a subsequent commit.
    
    Bug: https://bugs.gentoo.org/699972
    Package-Manager: Portage-2.3.66, Repoman-2.3.16
    Signed-off-by: Andrey Utkin <andrey_utkin@gentoo.org>

 net-im/mcabber/mcabber-1.1.0-r2.ebuild | 99 ++++++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)