ruby / curses

Ruby binding for curses, ncurses, and PDCurses. Formerly part of the ruby standard library.
Other
297 stars 34 forks source link

segfault on `init_screen` #52

Closed mjsir911 closed 4 years ago

mjsir911 commented 4 years ago

Hi,

I've been attempting to get curses working for ruby on my machine, but the first init_screen crashes everything.

stack trace: log.txt

I've narrowed it down to libtinfo, and bringing in libtinfow.so fixes it.

Not working version:

$ ldd ~/.gem/ruby/2.4.0/gems/curses-1.3.1/lib/curse
    linux-vdso.so.1 (0x00007ffd47b59000)
    libruby24.so.2.4 => /usr/lib64/libruby24.so.2.4 (0x00007f736b160000)
    libformw.so.6 => /usr/lib64/libformw.so.6 (0x00007f736b14c000)
    libmenuw.so.6 => /usr/lib64/libmenuw.so.6 (0x00007f736b142000)
    libncursesw.so.6 => /lib64/libncursesw.so.6 (0x00007f736b108000)
    libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f736b0cc000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f736b0aa000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f736aed9000)
    libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007f736ae60000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f736ae5a000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f736ae21000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f736ace3000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f736b453000)
    libtinfow.so.6 => /lib64/libtinfow.so.6 (0x00007f736aca7000)

Notice how libtinfow is being pulled in, just after libtinfo

Here's the quick patch I made to get everything up and running: tinfo.patch.gz

And the linked libraries after, works:

$ ldd ~/.gem/ruby/2.4.0/gems/curses-1.3.1/lib/curse
    linux-vdso.so.1 (0x00007ffe2554b000)
    libruby24.so.2.4 => /usr/lib64/libruby24.so.2.4 (0x00007f2ffaad9000)
    libformw.so.6 => /usr/lib64/libformw.so.6 (0x00007f2ffaac5000)
    libmenuw.so.6 => /usr/lib64/libmenuw.so.6 (0x00007f2ffaabb000)
    libncursesw.so.6 => /lib64/libncursesw.so.6 (0x00007f2ffaa81000)
    libtinfow.so.6 => /lib64/libtinfow.so.6 (0x00007f2ffaa45000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2ffaa23000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f2ffa852000)
    libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007f2ffa7d9000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f2ffa7d3000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f2ffa79a000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f2ffa65c000)

I suspect the cause of this is in part because of the distro I'm running, gentoo, which allows me to compile libraries in all sorts of wacky ways.

To aid with debugging, here's my install log for ncurses: ncurses_install.log.gz

shugo commented 4 years ago

Thanks for your report!

Fixed in 64d6023 to try libtinfow first.