From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Date: Fri, 8 Jan 2021 09:46:27 +0100 From: Michael Olbrich Message-ID: <20210108084627.GB3422558@pengutronix.de> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Subject: Re: [ptxdist] Bad ncurses configuration for mconf? List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: ptxdist@pengutronix.de, christian.melki@t2data.com On Fri, Dec 25, 2020 at 09:08:14PM +0100, Christian Melki wrote: > 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=) 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. I see the same pkg-config results here on Debian. I have no idea how this is supposed to work. > 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. Hmmm, what happens if you add -DNCURSES_WIDECHAR=0 to the cflags and link with ncurses? Does it work correctly now? > 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 The whole ncurses handling in configure.ac should probably cleaned up and simplified. Michael _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de