Bug#1340: ncurses setupterm() handles unknown terminals badly.
PACKAGE: ncurses
VERSION: 1.9.3
terminfo(3ncurses) terminfo(3ncurses)
[...]
int setupterm(char *term, int fildes, int *errret);
[...]
int setterm(char *term);
[...]
If errret is not null, then setupterm returns OK or ERR
and stores a status value in the integer pointed to by
errret. A status of 1 in errret is normal, 0 means that
the terminal could not be found, and -1 means that the
terminfo database could not be found. If errret is null,
setupterm prints an error message upon finding an error
and exits. [...]
Script started on Sun Sep 10 10:47:26 1995
root:~# cat x.c
#include <ncurses/curses.h>
#include <ncurses/term.h>
main() {
int rv;
rv = setupterm((char *) 0, 1, (int *) 0);
exit(rv);
}
root:~# TERM=crap
root:~# time ./x
"/etc/termcap", line 5: terminal 'linux', Unknown Capability - 'sb'
"/etc/termcap", line 38: terminal 'xterm', Unknown Capability - 'kn'
[... continues in this vein for several hundred lines ...]
"/etc/termcap", line 3618: terminal 'scoansi', Unknown Capability - 'Gu'
"/etc/termcap", line 3618: terminal 'scoansi', Unknown Capability - 'Gv'
[... very long delay ...]
'crap': Unknown terminal type.
Command had non-zero exit status 1
66.94user 1.84system 1:09.98elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (41major+368minor)pagefaults 0swaps
root:~#
Script done on Sun Sep 10 10:49:23 1995
Note that this took over a minute to complete.
mitchell@mdd.comm.mot.com (Bill Mitchell)
Reply to: