Subject: bin/34717: [dM] top demands termcap entry with li#
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 10/04/2006 22:15:01
>Number: 34717
>Category: bin
>Synopsis: [dM] top demands termcap entry with li#
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 04 22:15:00 +0000 2006
>Originator: der Mouse
>Release: NetBSD 4.99.1 (usr.bin/top screen.c,v 1.8)
>Organization:
Dis-
>Environment:
Any using top built with screen.c,v 1.8 (possibly others too)
>Description:
top(1) demands that the termcap entry for $TERM contain a li#
attribute, or it considers the terminal "dumb", even when stty
size holds a perfectly good size and there is no other reason
to treat it as dumb.
This is because the code in screen.c specifically checks for
"li", and, if it's not found, goes into dumb-terminal mode.
See line 178ff of screen.c (line number as of version 1.8).
This also runs contrary to the documentation, which says that
an "intelligent" terminal is one that supports cursor
addressing, clear screen, and clear to end of line
Note the lack of mention of a line count.
>How-To-Repeat:
Set $TERM to a terminal type for which $TERMCAP does not
contain an li#. Set the correct line count with stty rows.
Run top(1) and notice it runs in its "dumb terminal, do just
one display" mode. (I first noticed this with the termcap
entry in $TERMCAP; while experimenting, I discovered it applies
equally well with the termcap entry in a file and $TERMCAP
naming that file. With that clue, I tracked down the reason in
the code.)
In my case this came from a terminal emulator that doesn't put
li# or co# in the entry it puts in $TERMCAP, since the terminal
can be resized.
>Fix:
I'd be inclined to have a missing "li" just set a flag; if
get_screensize() fails to provide a line count, use that flag
to *then* go into dumb-terminal mode.
I'll add a patch to this PR if I find the round tuits to
construct one.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B