Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 720328 - net-misc/suite3270 => c3270 segmentation fault upon connecting to a remote host [libtinfo]
Summary: net-misc/suite3270 => c3270 segmentation fault upon connecting to a remote ho...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Robin Johnson
URL: https://0f5f.blogs.minster.io/2018/04...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-01 18:23 UTC by Adrien Dessemond
Modified: 2021-01-14 22:48 UTC (History)
2 users (show)

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


Attachments
tinfo fix from upstream for c3270/configure (suite3270-3.x-c3270-configure.patch,10.15 KB, patch)
2020-05-31 15:02 UTC, Adrien Dessemond
Details | Diff
tinfo fix from upstream for c3270/configure.in (suite3270-3.x-c3270-configure.in.patch,1.46 KB, patch)
2020-05-31 15:04 UTC, Adrien Dessemond
Details | Diff
E (file_720328.txt,529 bytes, text/plain)
2020-05-31 15:09 UTC, Adrien Dessemond
Details
Patch for suite3270-3.6_p8.ebuild (file_720328.txt,409 bytes, patch)
2020-05-31 15:40 UTC, Adrien Dessemond
Details | Diff
Patch for suite3270-3.5_p12.ebuild (file_720328.txt,534 bytes, patch)
2020-05-31 15:42 UTC, Adrien Dessemond
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrien Dessemond 2020-05-01 18:23:34 UTC
The now (in)famous libtinfo issue strikes again. When you launch c3270 (console version of the 3270 terminal emulator) and try to connect to a remote host like a hercule emulator (app-emulation/hercules) console session, the program segfaults.

Backtracing the coredump under GDB shows:

=============
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b5d0fd in _nc_setupscreen_sp (spp=spp@entry=0x7fffffffd588, slines=<optimized out>, scolumns=<optimized out>, output=output@entry=0x7ffff7b316a0 <_IO_2_1_stdout_>, filtered=<optimized out>, slk_format=slk_format@entry=0)
    at /usr/src/debug/sys-libs/ncurses-6.2-r1/ncurses-6.2/ncurses/base/lib_set_term.c:476
476             if (sp->_default_fg >= MaxColors) {
(gdb) 
(gdb) bt
#0  0x00007ffff7b5d0fd in _nc_setupscreen_sp (spp=spp@entry=0x7fffffffd588, slines=<optimized out>, scolumns=<optimized out>, output=output@entry=0x7ffff7b316a0 <_IO_2_1_stdout_>, filtered=<optimized out>, slk_format=slk_format@entry=0)
    at /usr/src/debug/sys-libs/ncurses-6.2-r1/ncurses-6.2/ncurses/base/lib_set_term.c:476
#1  0x00007ffff7b56c6c in newterm_sp (sp=<optimized out>, name=name@entry=0x0, ofp=ofp@entry=0x7ffff7b316a0 <_IO_2_1_stdout_>, ifp=ifp@entry=0x7ffff7b30980 <_IO_2_1_stdin_>) at /usr/src/debug/sys-libs/ncurses-6.2-r1/ncurses-6.2/ncurses/base/lib_newterm.c:223
#2  0x00007ffff7b57119 in newterm (name=0x0, ofp=0x7ffff7b316a0 <_IO_2_1_stdout_>, ifp=0x7ffff7b30980 <_IO_2_1_stdin_>) at /usr/src/debug/sys-libs/ncurses-6.2-r1/ncurses-6.2/ncurses/base/lib_newterm.c:356
#3  0x000055555557d4be in finish_screen_init ()
#4  0x000055555557da4f in screen_connect ()
#5  0x000055555558ba77 in st_changed ()
#6  0x00005555555943ae in host_connected ()
#7  0x00005555555b15c6 in connection_complete ()
#8  0x00005555555b16a2 in output_possible ()
#9  0x0000555555583103 in process_some_events ()
#10 0x0000555555583333 in process_events ()
#11 0x0000555555573332 in main ()
=============

Looking after the shared objects referenced in /usr/bin/c3270 :

=============
        linux-vdso.so.1 (0x00007ffef8c9f000)
        libssl.so.1.1 => /usr/lib64/libssl.so.1.1 (0x00007f38a6860000)
        libcrypto.so.1.1 => /usr/lib64/libcrypto.so.1.1 (0x00007f38a657a000)
        libreadline.so.8 => /lib64/libreadline.so.8 (0x00007f38a6523000)
        libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f38a64df000)
        libncursesw.so.6 => /lib64/libncursesw.so.6 (0x00007f38a649e000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007f38a6499000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f38a62d7000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f38a62b6000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f38a6298000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f38a6293000)
        libtinfow.so.6 => /lib64/libtinfow.so.6 (0x00007f38a624e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f38a6a59000)
=============


This is the exact same issue described for:
* dev-util/cgdb in the bug #682386 
* mail-client/mutt in the bug #651552

The later is covered in deep details in the following article:
https://0f5f.blogs.minster.io/2018/04/debugging-ncurses-to-fix-a-mutt-segfault-on-gentoo



Reproducible: Always

Steps to Reproduce:
1. run => /usr/bin/c3270
2. connect to a remote session (e.g. to an hercules emulator session...)

Actual Results:  
segmentation fault happens.


Seems to only impact the console version, other stuff like x3270 seems to remain  fully functional.
Comment 1 Adrien Dessemond 2020-05-01 21:17:28 UTC
Tested with net-misc/suite3270-3.5_p12 and net-misc/suite3270-3.6_p8 => same issue we have the segfault.
Comment 2 Adrien Dessemond 2020-05-05 19:27:40 UTC
Author published an attempt at upstream level:
https://sourceforge.net/p/x3270/code/ci/9af5b2d181b3d66864201e7016d6eda71240244b/

To be tested.
Comment 3 Adrien Dessemond 2020-05-31 15:02:44 UTC
Created attachment 642878 [details, diff]
tinfo fix from upstream for c3270/configure

Works both with 3.5 and 3.6
Comment 4 Adrien Dessemond 2020-05-31 15:04:33 UTC
Created attachment 642880 [details, diff]
tinfo fix from upstream for c3270/configure.in

Works with 3.5 and 3.6
Comment 5 Adrien Dessemond 2020-05-31 15:09:16 UTC
Created attachment 642882 [details]
E
Comment 6 Adrien Dessemond 2020-05-31 15:40:56 UTC
Created attachment 642884 [details, diff]
Patch for suite3270-3.6_p8.ebuild
Comment 7 Adrien Dessemond 2020-05-31 15:42:57 UTC
Created attachment 642886 [details, diff]
Patch for suite3270-3.5_p12.ebuild
Comment 8 SpanKY gentoo-dev 2021-01-14 21:35:37 UTC
i think this is fixed with the new 4.0 release.  please give it a try and report back.
Comment 9 Thymo van Beers 2021-01-14 22:48:02 UTC
Confirmed resolved on 4.0_p13