unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Valtteri Vuorikoski <vuori@notcom.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 64577@debbugs.gnu.org
Subject: bug#64577: 29.0.92; configure on NetBSD forces unstable terminfo library
Date: Wed, 12 Jul 2023 15:57:29 +0300	[thread overview]
Message-ID: <rtwyazo2mvkdjoacv5tqbbgolhzjxlj5mrzon2capyztvrf54a@oj3xrcl6mzkq> (raw)
In-Reply-To: <837cr572jt.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3254 bytes --]

On Wed, Jul 12, 2023 at 03:11:02PM +0300, Eli Zaretskii wrote:
> > configure on NetBSD forces using the native libterminfo library, even
> > when ncurses is available. When started with a TERM such xterm-256color,
> > this results in abort() in tputs1 (TERM=xterm works).
> > 
> > Hacking configure to use ncurses when available provides stable
> > operation on xterm-256color.
> 
> I'm not sure I understand.  The configure script first looks for a
> library with tputs, and it tries tinfo, ncurses, terminfo, curses,
> termcap, tinfow, ncursesw, in that order.  I understand that in your
> case it finds ncurses, which is good, right?
> 
> After that, the configure script decides whether to use terminfo or
> termcap.  It is here that for netbsd we decide to use termcap in
> certain situations instead of terminfo.  In your case, since ncurses
> was found, LIBS_TERMCAP should have been set to -lncurses, and this
> code:
> 
>   netbsd)
>     if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
>       TERMINFO=no
>       LIBS_TERMCAP="-ltermcap"
>     fi
> 
> should have set TERMINFO=no, which disables linking against terminfo.
> 
> So I don't think I understand what is going on there.

Finding ncurses is good, but unfortunately ncurses isn't what ends up
getting used. configure says:

checking for library containing tputs... -lncurses

but this happens:

$ ldd src/emacs | egrep 'term|curses'
     -lterminfo.1 => /usr/lib/libterminfo.so.1

Disabling the test above results in src/emacs being linked with
ncurses. That is, when I remove the whole "netbsd" special case
from configure this is the result:

$ ldd ~/emacs/bin/emacs | egrep 'term|curses'
   -lncurses.6 => /usr/pkg/lib/libncurses.so.6

> As I don't have access to a netbsd system, could you please post the
> config.log you get when configuring with a fresh tree of
> emacs-29.0.92, and also show the "set -x" expansion of the relevant
> parts of the configure script?  (Please compress those when posting if
> they are larger than, say, 0.5MB.)  I would like to use those to
> understand what happens on your system and why the configure script
> decides to use terminfo.

These are attached.

After some further investigation, it turns out that in NetBSD 9.3,
libtermcap is a symlink to libterminfo. So the configure test ends up
forcing -ltermcap and TERMINFO=no because LIBS_TERMCAP=-lncurses (so
!= -lterminfo), which actually links with libterminfo due to the
symlink.

So with current NetBSD, I don't think the test as it stands could ever
do anything useful, since there is only terminfo and apparently a
termcap-like compatibility wrapper around terminfo.

Looking at a git mirror of NetBSD system sources, this seems to have
been the case since at least 2010.

> Also, do you happen to know when terminfo on NetBSD started to be
> buggy?  I would think that the change in bug#6190 did work at the
> time, so at least back then NetBSD did have a workable terminfo.  When
> did it start failing?

I have a build of emacs 27.0.91 on another system built with a similar
environment (ncurses should be available but emacs is linked with
libterminfo) and it also aborts in tparam1 with TERM=xterm-256color,
so looks like this has been happening for quite a while.

 -Valtteri
 

[-- Attachment #2: config.log.gz --]
[-- Type: application/gzip, Size: 72810 bytes --]

[-- Attachment #3: config.x --]
[-- Type: text/plain, Size: 8180 bytes --]

+ printf '%s\n' 'configure:22791: checking for library containing tputs' >&5
+ printf '%s' 'checking for library containing tputs... ' >&6
checking for library containing tputs... + test
+ as_fn_nop
+ return 1
+ test netbsd = mingw32
+ tputs_libraries='tinfo ncurses terminfo curses termcap tinfow ncursesw'
+ for tputs_library=''
+ OLIBS='-lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo'
+ test -z ''
+ emacs_cv_tputs_lib='none required'
+ test no = yes
+ as_fn_nop
+ return 1
+ cat confdefs.h - <<... >conftest.c
+ ac_fn_c_try_run 22845
+ as_lineno=22845 as_lineno_stack=as_lineno_stack=
+ using redirections: >&5 do {
+ ac_try='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5 '
+ ac_try_echo='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5 '
+ eval 'ac_try_echo="$as_me:22845: $CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5 "'
+ ac_try_echo='configure:22845: gcc -o conftest -isystem /usr/X11R7/include -I/usr/pkg/include -O -isystem /usr/pkg/include -D_REENTRANT -isystem /usr/pkg/include/cairo -isystem /usr/pkg/include -isystem /usr/pkg/include/freetype2 -isystem /usr/pkg/include -isystem /usr/pkg/include/libpng16 -isystem /usr/X11R7/include/pixman-1 -isystem /usr/X11R7/include -isystem /usr/X11R7/include    -L/usr/pkg/lib -R/usr/pkg/lib -R/usr/X11R7/lib -L/usr/X11R7/lib conftest.c -lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo >&5 '
+ printf '%s\n' 'configure:22845: gcc -o conftest -isystem /usr/X11R7/include -I/usr/pkg/include -O -isystem /usr/pkg/include -D_REENTRANT -isystem /usr/pkg/include/cairo -isystem /usr/pkg/include -isystem /usr/pkg/include/freetype2 -isystem /usr/pkg/include -isystem /usr/pkg/include/libpng16 -isystem /usr/X11R7/include/pixman-1 -isystem /usr/X11R7/include -isystem /usr/X11R7/include    -L/usr/pkg/lib -R/usr/pkg/lib -R/usr/X11R7/lib -L/usr/X11R7/lib conftest.c -lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo >&5 '
+ } done
+ using redirections: 2>&5 do subshell (
+ ) done subshell
+ ac_status=1
+ printf '%s\n' 'configure:22845: $? = 1' >&5
+ test 1 = 0
+ as_fn_nop
+ return 1
+ printf '%s\n' 'configure: program exited with status 1' >&5
+ printf '%s\n' 'configure: failed program was:' >&5
+ sed 's/^/| /' conftest.c >&5
+ ac_retval=1
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval as_lineno_stack=
+ as_lineno_stack=''
+ unset as_lineno
+ as_fn_set_status 1
+ return 1
+ as_fn_nop
+ return 1
+ emacs_cv_tputs_lib=no
+ rm -f core '*.core' 'core.conftest.*' gmon.out bb.out conftest conftest.o conftest.beam conftest.c
+ LIBS='-lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo'
+ test Xno '!=' Xno
+ for tputs_library=tinfo
+ OLIBS='-lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo'
+ test -z tinfo
+ emacs_cv_tputs_lib=-ltinfo
+ LIBS='-ltinfo -lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo'
+ test no = yes
+ as_fn_nop
+ return 1
+ cat confdefs.h - <<... >conftest.c
+ ac_fn_c_try_run 22845
+ as_lineno=22845 as_lineno_stack=as_lineno_stack=
+ using redirections: >&5 do {
+ ac_try='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5 '
+ ac_try_echo='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5 '
+ eval 'ac_try_echo="$as_me:22845: $CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5 "'
+ ac_try_echo='configure:22845: gcc -o conftest -isystem /usr/X11R7/include -I/usr/pkg/include -O -isystem /usr/pkg/include -D_REENTRANT -isystem /usr/pkg/include/cairo -isystem /usr/pkg/include -isystem /usr/pkg/include/freetype2 -isystem /usr/pkg/include -isystem /usr/pkg/include/libpng16 -isystem /usr/X11R7/include/pixman-1 -isystem /usr/X11R7/include -isystem /usr/X11R7/include    -L/usr/pkg/lib -R/usr/pkg/lib -R/usr/X11R7/lib -L/usr/X11R7/lib conftest.c -ltinfo -lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo >&5 '
+ printf '%s\n' 'configure:22845: gcc -o conftest -isystem /usr/X11R7/include -I/usr/pkg/include -O -isystem /usr/pkg/include -D_REENTRANT -isystem /usr/pkg/include/cairo -isystem /usr/pkg/include -isystem /usr/pkg/include/freetype2 -isystem /usr/pkg/include -isystem /usr/pkg/include/libpng16 -isystem /usr/X11R7/include/pixman-1 -isystem /usr/X11R7/include -isystem /usr/X11R7/include    -L/usr/pkg/lib -R/usr/pkg/lib -R/usr/X11R7/lib -L/usr/X11R7/lib conftest.c -ltinfo -lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo >&5 '
+ } done
+ using redirections: 2>&5 do subshell (
+ ) done subshell
+ ac_status=1
+ printf '%s\n' 'configure:22845: $? = 1' >&5
+ test 1 = 0
+ as_fn_nop
+ return 1
+ printf '%s\n' 'configure: program exited with status 1' >&5
+ printf '%s\n' 'configure: failed program was:' >&5
+ sed 's/^/| /' conftest.c >&5
+ ac_retval=1
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval as_lineno_stack=
+ as_lineno_stack=''
+ unset as_lineno
+ as_fn_set_status 1
+ return 1
+ as_fn_nop
+ return 1
+ emacs_cv_tputs_lib=no
+ rm -f core '*.core' 'core.conftest.*' gmon.out bb.out conftest conftest.o conftest.beam conftest.c
+ LIBS='-lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo'
+ test Xno '!=' Xno
+ for tputs_library=ncurses
+ OLIBS='-lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo'
+ test -z ncurses
+ emacs_cv_tputs_lib=-lncurses
+ LIBS='-lncurses -lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo'
+ test no = yes
+ as_fn_nop
+ return 1
+ cat confdefs.h - <<... >conftest.c
+ ac_fn_c_try_run 22845
+ as_lineno=22845 as_lineno_stack=as_lineno_stack=
+ using redirections: >&5 do {
+ ac_try='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5 '
+ ac_try_echo='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5 '
+ eval 'ac_try_echo="$as_me:22845: $CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5 "'
+ ac_try_echo='configure:22845: gcc -o conftest -isystem /usr/X11R7/include -I/usr/pkg/include -O -isystem /usr/pkg/include -D_REENTRANT -isystem /usr/pkg/include/cairo -isystem /usr/pkg/include -isystem /usr/pkg/include/freetype2 -isystem /usr/pkg/include -isystem /usr/pkg/include/libpng16 -isystem /usr/X11R7/include/pixman-1 -isystem /usr/X11R7/include -isystem /usr/X11R7/include    -L/usr/pkg/lib -R/usr/pkg/lib -R/usr/X11R7/lib -L/usr/X11R7/lib conftest.c -lncurses -lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo >&5 '
+ printf '%s\n' 'configure:22845: gcc -o conftest -isystem /usr/X11R7/include -I/usr/pkg/include -O -isystem /usr/pkg/include -D_REENTRANT -isystem /usr/pkg/include/cairo -isystem /usr/pkg/include -isystem /usr/pkg/include/freetype2 -isystem /usr/pkg/include -isystem /usr/pkg/include/libpng16 -isystem /usr/X11R7/include/pixman-1 -isystem /usr/X11R7/include -isystem /usr/X11R7/include    -L/usr/pkg/lib -R/usr/pkg/lib -R/usr/X11R7/lib -L/usr/X11R7/lib conftest.c -lncurses -lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo >&5 '
+ } done
+ using redirections: 2>&5 do subshell (
+ ) done subshell
+ ac_status=0
+ printf '%s\n' 'configure:22845: $? = 0' >&5
+ test 0 = 0
+ ac_try='./conftest$ac_exeext'
+ using redirections: >&5 do {
+ ac_try_echo='./conftest$ac_exeext'
+ eval 'ac_try_echo="$as_me:22845: ./conftest$ac_exeext"'
+ ac_try_echo='configure:22845: ./conftest'
+ printf '%s\n' 'configure:22845: ./conftest'
+ } done
+ using redirections: 2>&5 do subshell (
+ ) done subshell
+ ac_status=0
+ printf '%s\n' 'configure:22845: $? = 0' >&5
+ test 0 = 0
+ ':'
+ ac_retval=0
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval as_lineno_stack=
+ as_lineno_stack=''
+ unset as_lineno
+ as_fn_set_status 0
+ return 0
+ ':'
+ rm -f core '*.core' 'core.conftest.*' gmon.out bb.out conftest conftest.o conftest.beam conftest.c
+ LIBS='-lsqlite3 -lX11   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lcairo'
+ test X-lncurses '!=' Xno
+ break
+ printf '%s\n' 'configure:22862: result: -lncurses' >&5
+ printf '%s\n' -lncurses >&6
-lncurses
+ ':'
+ LIBS_TERMCAP=-lncurses
+ TERMINFO=yes
+ test x-lncurses '!=' x-lterminfo
+ TERMINFO=no
+ LIBS_TERMCAP=-ltermcap
+ TERMCAP_OBJ=tparam.o
+ test no = yes
+ test X-ltermcap = X-lncurses

  reply	other threads:[~2023-07-12 12:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11 20:37 bug#64577: 29.0.92; configure on NetBSD forces unstable terminfo library vuori
2023-07-12 12:11 ` Eli Zaretskii
2023-07-12 12:57   ` Valtteri Vuorikoski [this message]
2023-07-12 13:32     ` Eli Zaretskii
2023-07-12 14:06       ` Valtteri Vuorikoski
2023-07-12 16:06         ` Eli Zaretskii
2023-07-12 20:22           ` Valtteri Vuorikoski
2023-07-13  5:19             ` Eli Zaretskii
2023-07-13  9:35               ` Valtteri Vuorikoski
2023-07-15  8:17                 ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=rtwyazo2mvkdjoacv5tqbbgolhzjxlj5mrzon2capyztvrf54a@oj3xrcl6mzkq \
    --to=vuori@notcom.org \
    --cc=64577@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).