mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Christian Melki <christian.melki@t2data.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] Bad ncurses configuration for mconf?
Date: Fri, 25 Dec 2020 21:08:14 +0100	[thread overview]
Message-ID: <b326a52d-e53a-823a-c73e-eac86f7fe6ea@t2data.com> (raw)

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

             reply	other threads:[~2020-12-25 20:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25 20:08 Christian Melki [this message]
2021-01-08  8:46 ` Michael Olbrich
2021-01-08 16:15   ` Christian Melki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b326a52d-e53a-823a-c73e-eac86f7fe6ea@t2data.com \
    --to=christian.melki@t2data.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox