GNU bug report logs - #64577
29.0.92; configure on NetBSD forces unstable terminfo library

Previous Next

Package: emacs;

Reported by: vuori <at> notcom.org

Date: Tue, 11 Jul 2023 20:38:01 UTC

Severity: normal

Found in version 29.0.92

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 64577 <at> debbugs.gnu.org (full text, mbox):

From: Valtteri Vuorikoski <vuori <at> notcom.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64577 <at> debbugs.gnu.org
Subject: Re: bug#64577: 29.0.92; configure on NetBSD forces unstable terminfo
 library
Date: Wed, 12 Jul 2023 15:57:29 +0300
[Message part 1 (text/plain, inline)]
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
 
[config.log.gz (application/gzip, attachment)]
[config.x (text/plain, attachment)]

This bug report was last modified 1 year and 350 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.