mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] Bad ncurses configuration for mconf?
@ 2020-12-25 20:08 Christian Melki
  2021-01-08  8:46 ` Michael Olbrich
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Melki @ 2020-12-25 20:08 UTC (permalink / raw)
  To: ptxdist

Ptxdist seems to assume things about the ncurses local build that 
doesn't always turn up to be usable.

I use a ncurses-6.2 build in Slackware. Pretty normal build.

mconf headers point to the ncurses library, not ncursesw.

mconf gets built with:
     -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
and is linked with:
      linux-vdso.so.1 (0x00007ffcd5f30000)
     libncurses.so.6 => /lib64/libncurses.so.6 (0x00007f6914c68000)
     libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f6914c37000)
     libc.so.6 => /lib64/libc.so.6 (0x00007f6914a52000)
     libdl.so.2 => /lib64/libdl.so.2 (0x00007f6914a4d000)
     /lib64/ld-linux-x86-64.so.2 (0x00007f6914cbd000)

And mconf segfaults with:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f84b9a in waddch () from /lib64/libncurses.so.6

(gdb) bt
#0  0x00007ffff7f84b9a in waddch () from /lib64/libncurses.so.6
#1  0x0000000000415c78 in attr_clear (win=0xcdf820, height=49, 
width=299, attr=<optimized out>) at lxdialog/util.c:250
#2  0x0000000000415cfc in dialog_clear () at lxdialog/util.c:262
#3  0x0000000000416274 in init_dialog (backtitle=backtitle@entry=0x0) at 
lxdialog/util.c:336
#4  0x000000000040272c in main (ac=2, av=0x7ffffffefd78) at mconf.c:1017

... second loop pass. Height = 0 passes the width loop. Height = 1, 
Width = 0 segfaults.

(gdb) print j
$8 = 298
(gdb) n
250                waddch(win, ' ');
(gdb) n
249            for (j = 0; j < width; j++)
(gdb) n
247        for (i = 0; i < height; i++) {
(gdb) n
248            wmove(win, i, 0);
(gdb) print i
$9 = 1
(gdb) n
249            for (j = 0; j < width; j++)
(gdb) n
250                waddch(win, ' ');
(gdb) n
Program received signal SIGSEGV, Segmentation fault.

I am not sure what to blame here or if I understand things.
Or if it's resonable that ncurses should explode like this.

Seems pkg-config cflags answers:
pkg-config --cflags ncurses -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600

But if I understand things >= 600 = wide char header?
the pkg-config answers the same for ncursesw.

So the program will compile and link just fine.
If I use xterm and rxvt as $TERM the mconf program crashes, but is fine 
with vt100.

Is this related to ext-colors support somehow?
If I force the program to link with ncursesw, then all is fine.

My best guess is that the terminal is ext-color, program gets built with 
wchar-support but linked with ncurses.
This probably shouldn't explode in ncurses, but I think it's also a 
misconfiguration build.

I would suggest that ptxdist uses ncursesw + headers if found and 
ncurses without wchar if not found.

Kernel seems to prefer something similar?
https://elixir.bootlin.com/linux/v5.10.2/source/scripts/kconfig/mconf-cfg.sh

Merry Christmas!

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-08 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-25 20:08 [ptxdist] Bad ncurses configuration for mconf? Christian Melki
2021-01-08  8:46 ` Michael Olbrich
2021-01-08 16:15   ` Christian Melki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox