Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 751817 - sys-apps/duc segmentation fault (mixing ncursesw and tinfo)
Summary: sys-apps/duc segmentation fault (mixing ncursesw and tinfo)
Status: RESOLVED DUPLICATE of bug 729362
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Adam Feldman
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-29 23:32 UTC by bugzilla-e680a21cd5fe3f9d
Modified: 2020-10-30 00:04 UTC (History)
1 user (show)

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


Attachments
gdb segfault backtrace (backtrace,2.66 KB, text/plain)
2020-10-29 23:32 UTC, bugzilla-e680a21cd5fe3f9d
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bugzilla-e680a21cd5fe3f9d 2020-10-29 23:32:57 UTC
Created attachment 669236 [details]
gdb segfault backtrace

It appears that under some circumstances, sys-apps/duc (USE +ncurses) will successfully build, though it will link against libncursesw and libtinfo. Note that the latter is not the "wide char" variant. This mismatch results in an immediate segfault when using the `duc ui` subcommand. I've confirmed this happens on two similar Gentoo environments of mine with duc versions 1.4.1-r1 and 1.4.3-1.

I have managed to fix this in a local overlay by modifying the provided `duc-1.4.1-tinfo.patch` in the portage tree to look explicitly for `tinfow`. Unfortunately, I am not familiar enough with the `autoconf` toolchain to have it gracefully check for both wide and narrow versions and select matching sets.

A gdb backtrace of the fault is attached.

The fact that it segfaulted on a void function so early in the process struck me as odd. So I tried building a simple process that did nothing but call `initscr()`, and it compiled an executed fine.

I dug around the `duc` build files (using `FEATURES=noclean`) to see what it was linking with instead, and found this line in the finished Makefile.

`LIBS = -lX11 -ltinfo -lncursesw -lm`

I noticed there was a patch for `configure.ac` and `tinfo` in the tree, so on a hunch, did the aforementioned hack for `tinfow` in my local overlay, and that did the trick.

A bit further searching online helped me find this other ticket for mail-client/mutt, which seems somewhat similar.

https://bugs.gentoo.org/651552
https://0f5f.blogs.minster.io/2018/04/debugging-ncurses-to-fix-a-mutt-segfault-on-gentoo/

If you need any further information to fix this bug, please let me know. This is my first time filing a report so I'm not sure how much info is "too much."

Sorry I can't just provide a patch outright. I'm a Python developer by trade, so some of the autoconf toolchain stuff is black magic voodoo to me. I remember just enough C, make, and gdb to be dangerous, hahah.

Thank you!
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-10-30 00:04:20 UTC
This is actually a duplicate of bug 729362, but the write-up and analysis is really helpful here. Could you post it on the other bug, or I can for you?

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