Date: Wed, 17 Dec 2003 18:54:34 -0800 (PST) From: Daniel Hulme <d@diefree.com> To: FreeBSD-gnats-submit@FreeBSD.org Cc: d@diefree.com Subject: misc/60352: [PATCH] buildworld fails in sysinstall if terminfo database in /usr/share/misc/terminfo Message-ID: <200312180254.hBI2sYDO019792@bsd.diefree.com> Resent-Message-ID: <200312180300.hBI30YFx077304@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 60352 >Category: misc >Synopsis: [PATCH] buildworld fails in sysinstall if terminfo database in /usr/share/misc/terminfo >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 17 19:00:34 PST 2003 >Closed-Date: >Last-Modified: >Originator: Daniel Hulme <d@diefree.com> >Release: FreeBSD 5.2-RC i386 >Organization: None >Environment: System: FreeBSD bsd.diefree.com 5.2-RC FreeBSD 5.2-RC #1: Mon Dec 15 14:12:25 PST 2003 daniel@bsd.diefree.com:/usr/obj/usr/src/sys/kernel_pf i386 (this is my current kernel, the problem occurs on 5.2-RC vanilla as well) >Description: The compilation of [/usr/src/usr.sbin/sysinstall] depends on a small program called "rtermcap". The program is used to generate a file called "makedevs.c" from several termcap entries (ansi, xterm, cons25, etc.). rtermcap, in turn, relies on a c call (ncurses) to "tgetent," which checks for a termcap entry, and fills a buffer with the terminal information. On closer inspection, however, "tgetent" is also capable of using terminfo, and in fact prefers terminfo over termcap (if the terminal exists in terminfo, it will never check termcap--perhaps this behavior can be changed in ncurses, but I'm not sure it should be). Unfortunately, it acts a little differently when using terminfo: [man curs_termcap] The tgetent routine loads the entry for name. It returns 1 on success, 0 if there is no such entry, and -1 if the terminfo database could not be found. The emulation ignores the buffer pointer bp. So, in the event that a terminfo database is present, tgetent will use it, and will not fill the buffer. However, the Makefile in [/usr/src/usr.sbin/sysinstall] relies on the buffer being filled, so it can use this data to create the arrays in makedevs.c. There is no detection of this issue currently, and the compilation of sysinstall fails with the following message(s), due to the arrays being empty: makedevs.c:4: error: syntax error before ',' token makedevs.c:7: error: syntax error before ',' token makedevs.c:10: error: syntax error before ',' token makedevs.c:13: error: syntax error before ',' token makedevs.c:16: error: syntax error before ',' token makedevs.c:19: error: syntax error before ',' token makedevs.c:22: error: syntax error before ',' token makedevs.c:25: error: syntax error before ',' token makedevs.c:28: error: syntax error before ',' token makedevs.c:31: error: syntax error before ',' token >How-To-Repeat: [Install linux compat] [Link linux terminfo database to /usr/share/misc] ln -s /usr/compat/linux/usr/share/terminfo /usr/share/misc/ [note that any method of installing a valid terminfo where ncurses will find it should be sufficient] [Compile sysinstall] cd /usr/src/usr.sbin/sysinstall/ make clean make [Watch the errors] >Fix: --- patch-rtermcap.c begins here --- --- rtermcap_orig.c Sun May 7 15:07:53 1995 +++ rtermcap.c Wed Dec 17 18:31:21 2003 @@ -1,15 +1,23 @@ -#include <stdio.h> -#include <termcap.h> +#include <stdlib.h> int main(int argc, char **argv) { - char buf[4096]; + char * files[]={ "/etc/termcap" }; + char * tbuf; + char * buf; + char * c; + char d; int i; - if (argc < 2) return 1; - i = tgetent(buf, argv[1]); - printf("%s",buf); + i=cgetent(&tbuf, files, argv[1]); + for (c = tbuf; *c != 0; c++) { + if(*c != '\t' && (*c != 58 || d != 58)) { + printf("%c", *c); + d = *c; + } + } + cgetclose(); return 0; } --- patch-rtermcap.c ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312180254.hBI2sYDO019792>