From owner-freebsd-bugs@FreeBSD.ORG Wed Dec 17 19:00:41 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F19B916A4CE for ; Wed, 17 Dec 2003 19:00:40 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4DCCA43D55 for ; Wed, 17 Dec 2003 19:00:37 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) hBI30YFR077305 for ; Wed, 17 Dec 2003 19:00:34 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id hBI30YFx077304; Wed, 17 Dec 2003 19:00:34 -0800 (PST) (envelope-from gnats) Resent-Date: Wed, 17 Dec 2003 19:00:34 -0800 (PST) Resent-Message-Id: <200312180300.hBI30YFx077304@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Daniel Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 164CD16A4CE for ; Wed, 17 Dec 2003 18:53:17 -0800 (PST) Received: from bsd.diefree.com (c-24-6-31-57.client.comcast.net [24.6.31.57]) by mx1.FreeBSD.org (Postfix) with SMTP id 3874D43D31 for ; Wed, 17 Dec 2003 18:53:15 -0800 (PST) (envelope-from daniel@bsd.diefree.com) Received: (qmail 19796 invoked from network); 18 Dec 2003 02:54:35 -0000 Received: from localhost (HELO bsd.diefree.com) (127.0.0.1) by localhost with SMTP; 18 Dec 2003 02:54:35 -0000 Received: (from root@localhost) by bsd.diefree.com (8.12.10/8.12.10/Submit) id hBI2sYDO019792; Wed, 17 Dec 2003 18:54:34 -0800 (PST) (envelope-from daniel) Message-Id: <200312180254.hBI2sYDO019792@bsd.diefree.com> Date: Wed, 17 Dec 2003 18:54:34 -0800 (PST) From: Daniel Hulme To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: d@diefree.com Subject: misc/60352: [PATCH] buildworld fails in sysinstall if terminfo database in /usr/share/misc/terminfo X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Daniel List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Dec 2003 03:00:41 -0000 >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 >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 -#include +#include 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: