Skip Menu |
 

Subject: telnet: setupterm() detection fails when dummy -ltermcap exists on system
Download (untitled) / with headers
text/plain 1.2KiB
Hi,

http://bugs.gentoo.org/show_bug.cgi?id=124405
http://bugs.gentoo.org/show_bug.cgi?id=135288

mit-krb5-1.4.3 has a bug with setupterm() library detection. The
autoconf script src/appl/telnet/configure.in checks whether main()
exists in -ltermcap. However, some Linux machines have a
terminfo-compatibility library called "libtermcap-compat", which sits at
/lib/libtermcap.so, which has some things like tputs_baud_rate() and
ospeed(), but no setupterm(). This causes two problems:

1. A linker failure later on, because it ends up trying to link
"telnet" against -ltermcap instead of the (more useful) -lncurses.

2. A prototype mismatch error, because the internal setupterm() doesn't
match the prototype defined in the ncurses header files. (The "tname"
argument is missing a "const".)

To fix #1, check for "setupterm" in -ltermcap, not "main". See the
attached patch, mit-krb5-setupterm.patch.

To fix #2, add a "const", or "NCURSES_CONST" or whatever. See
http://bugs.gentoo.org/attachment.cgi?id=90193&action=view - I'm not
sure how portable this is, but it fixes compilation on linux with newer
versions of gcc/ncurses. Anyway, fixing #1 causes setupterm() to be
ifdef'ed out anyway, so issue #2 is hidden.

Mark
--- krb5-1.4.3/src/appl/telnet/configure.in.orig 2006-05-21 16:28:39.187870750 -0400
+++ krb5-1.4.3/src/appl/telnet/configure.in 2006-05-21 16:29:26.758843750 -0400
@@ -50,7 +50,7 @@
#endif
])
dnl
-AC_CHECK_LIB(termcap,main,AC_DEFINE(TERMCAP)
+AC_CHECK_LIB(termcap,setupterm,AC_DEFINE(TERMCAP)
LIBS="$LIBS -ltermcap",
AC_CHECK_LIB(curses,setupterm,LIBS="$LIBS -lcurses",
AC_CHECK_LIB(ncurses,setupterm,LIBS="$LIBS -lncurses")
@@ -96,7 +96,7 @@
dnl from old telnetd/configure.in
dnl
dnl AC_PROG_INSTALL
-AC_CHECK_LIB(termcap,main,AC_DEFINE(TERMCAP)
+AC_CHECK_LIB(termcap,setupterm,AC_DEFINE(TERMCAP)
LIBS="$LIBS -ltermcap",
AC_CHECK_LIB(curses,setupterm,LIBS="$LIBS -lcurses",
AC_CHECK_LIB(ncurses,setupterm,LIBS="$LIBS -lncurses")