Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 206201 - sys-libs/ncurses terminfo database issue
Summary: sys-libs/ncurses terminfo database issue
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Other (show other bugs)
Hardware: x86 OS X
: High normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-16 22:18 UTC by Maarten Billemont
Modified: 2011-12-15 17:23 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maarten Billemont 2008-01-16 22:18:52 UTC
tput is a program in the ncurses package that outputs terminal control codes.  these codes differ from terminal to terminal and are maintained in a terminfo database (see man terminfo, /usr/share/terminfo).  tput vi is supposed to turn the cursor invisible.  /usr/bin/tput vi does this for me in Terminal.app, but the tput compiled by Gentoo Prefix does not:

$ tput vi
tput: unknown terminfo capability 'vi'

TERM is set to xterm-new because that appears to be the closest TERM entry corresponding to Terminal's capabilities.
Comment 1 Maarten Billemont 2008-01-16 22:33:03 UTC
The problem arises because of a difference in terminfo data in these files:

/Gentoo/usr/share/terminfo/s/screen.xterm-new -> ../s/screen.xterm-xfree86
/usr/share/terminfo/73/screen.xterm-new

They contain different data.  They are compiled by ncurses.  Unfurtunately I know very little of how these databases are constructed.
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2008-01-17 20:15:07 UTC
Hmm, it seems that terminfo is pretty screwed up in prefix. I'm on x86-linux and this is interesting:

% type -p tic
/home/jolexa/portage/linux-32/usr/bin/tic
% tic $EPREFIX/usr/share/terminfo/x/xterm
"/home/jolexa/portage/linux-32/usr/share/terminfo/x/xterm", line 1, col 1: Illegal character (expected alphanumeric or @%&*!#) - '^Z'

Adding myself to CC so I can see if there is a solution down the road. Let me know if you need anything else.
Comment 3 Jeremy Olexa (darkside) (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2008-01-26 00:58:22 UTC
(In reply to comment #2)
> Hmm, it seems that terminfo is pretty screwed up in prefix. I'm on x86-linux
> and this is interesting:
> 
> % type -p tic
> /home/jolexa/portage/linux-32/usr/bin/tic
> % tic $EPREFIX/usr/share/terminfo/x/xterm
> "/home/jolexa/portage/linux-32/usr/share/terminfo/x/xterm", line 1, col 1:
> Illegal character (expected alphanumeric or @%&*!#) - '^Z'
> 
> Adding myself to CC so I can see if there is a solution down the road. Let me
> know if you need anything else.

Nevermind, same output on Gentoo Linux. I don't know much about terminfo it seems. =/
Comment 4 Fabian Groffen gentoo-dev 2008-01-26 09:45:32 UTC
% tic /usr/share/terminfo/x/xterm
"/usr/share/terminfo/x/xterm", line 1, col 1: Illegal character (expected alphanumeric or @%&*!#) - '^Z'


Indeed, so it's not a prefix isssue.  I am not familiar with tic and toe.  I know I made my own terminfo file once myself.  However, tic according to `man` is a compiler, and looking at /usr/share/terminfo/x/xterm, it is definitely not a plain text file.

% infocmp xterm
#       Reconstructed via infocmp from file: /etc/terminfo/x/xterm
xterm|xterm terminal emulator (X Window System),
...
(lots of control statements)

Maybe you're just looking for infocmp?  That output is something that tic likes.
Comment 5 Fabian Groffen gentoo-dev 2008-05-21 09:49:35 UTC
took me 30 mins to find this bug back
Comment 6 Thomas Dickey 2008-07-02 22:34:31 UTC
tput (for ncurses and other terminfo-based curses) uses the terminfo
mnemonics.  "vi" is termcap for terminfo "civis".
Comment 7 Fabian Groffen gentoo-dev 2009-10-25 09:16:00 UTC
I understand the issue as ncurses not knowing about Terminal.app precisely enough, can't find anything for that in Apple's patches for ncurses though.

The issue shows itself for me that the cursor isn't hidden in e.g. mutt's pager.  I lack the knowledge to fix this, or find out where the exact problem is.  The same ncurses and mutt (binaries/libraries) properly hide the cursor when run from xterm in Apple's X11.
Comment 8 Thomas Dickey 2009-10-25 13:34:10 UTC
Terminal.app doesn't match xterm.

There are terminfo entries in ncurses which are supposed to
match Terminal.app ("nsterm", etc).  To see some of those
differences, try "infocmp nsterm xterm-new".  I don't know
whether Terminal.app supports some flavor of civis/cvvis/cnorm,
but will add those if I get a reliable report to that effect.

(notwithstanding various developer's claims that their program
"emulates xterm", those are usually just claims - not fact).
Comment 9 Fabian Groffen gentoo-dev 2009-10-25 17:39:16 UTC
On my Mac using Terminal.app:

If I set TERM=nsterm I have colours, but bold capability seems to have vanished.  Cursor remains visible.  If I set TERM=dtterm, I have colours, boldness and an invisible cursor in mutt's pager.  I compare this to xterm-color, which Terminal.app suggests itself, and see the only difference being the invisible cursor working on dtterm, and not working on xterm-color.  The home and end sequences seem to confuse Vim using dtterm while they work fine using xterm-color. 

Does this help in any way?
Comment 10 Thomas Dickey 2009-10-26 00:11:16 UTC
The terminfo feature related to bold is ncv: the nsterm
entry sets that to 37, which means (see the long terminfo manpage)
that ncurses will assume that bold, reverse and standout do
not work with color.  It's possible that they do not; the
relevant test is in the "tack" program.  (ncurses will
simulate reverse/standout using colors, but bold is harder).

The invisible-cursor stuff is the strings that infocmp would
show:
    cnorm=\E[?25h, civis=\E[?25l,

If you have infocmp, you also should have tic, and can experiment
with modifying a copy of the nsterm entry.  (For changing cnorm/civis,
it would be nice to know the version number that Terminal.app has;
but for changing the ncv value, I'd want some tests run with "tack").

infocmp produces a source, which can be edited and recompiled with tic.
(By setting $TERMINFO, you can point things to a different directory,
and not have to modify the system's terminfo database).
Comment 11 Fabian Groffen gentoo-dev 2009-10-27 21:18:04 UTC
alright, nsterm and xterm-color simply lack cnorm and civis (talking about sys-libs/ncurses-5.7-r2 here), like dtterm and xterm have.

Because xterm-color is more functional than nsterm to me I just modified my xterm-color terminfo file to include cnorm and civis.  That gives me the invisible cursor capability.

I'm on OSX 10.4, using Terminal.app Version 1.5.1 (133-1).

nsterm and xterm-color have considerable differences.  Running tack for instance pointed out that my terminal indeed doesn't support blink, like nsterm defines, but xterm-color correctly doesn't.

I'll have to go through the list of infocmp because some properties from nsterm look like I would like to have in my terminfo file too.
Comment 12 Thomas Dickey 2009-10-27 21:24:51 UTC
The usual issue with xterm-color is the bce property.
(tack does have a screen for this, in the color section).

Also, of course, function keys are probably incorrect.

In newer descriptions, I've been adding information where
terminals send different escape sequences for shift-,
control- and meta-modifiers applied to cursor- and editing-keypad
keys.  (A newer Terminal.app may do this - I'm curious).
Comment 13 Fabian Groffen gentoo-dev 2009-10-28 07:37:25 UTC
I have an OSX 10.5 installation at hand, so I can boot into that machine, and
see what Terminal.app does there later.

The bce test seems to do well "(bce) is false in the data base." and I don't
see blue lines.

My infocmp of my modified xterm-color and original nsterm look like this now:

comparing xterm-color to nsterm.
    comparing booleans.
        auto_left_margin: F:T.
        has_meta_key: T:F.
        move_insert_mode: T:F.
        xon_xoff: F:T.
    comparing numbers.
        no_color_video: NULL, 37.
    comparing strings.
        acs_chars: '``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~',
'+\335\054\334-\366.\3770#`\327a\072f\241g\261h#i\360jjkkllmmnno\370p\370q\321rrssttuuvvwwxxy\262z\263{\271|\255}\243~\245'.
        clear_screen: '\E[H\E[2J', '\E[H\E[J'.
        clr_bol: NULL, '\E[1K'.
        cursor_invisible: '\E[?25l', NULL.
        cursor_normal: '\E[?25h', NULL.
        delete_character: '\E[P', NULL.
        ena_acs: '\E)0', '\E(B\E)0'.
        enter_blink_mode: NULL, '\E[5m'.
        enter_insert_mode: '\E[4h', NULL.
        exit_attribute_mode: '\E[m', '\E[m\017'.
        exit_insert_mode: '\E[4l', NULL.
        init_2string: '\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>', NULL.
        key_a1: NULL, '\EOq'.
        key_a3: NULL, '\EOs'.
        key_b2: NULL, '\EOr'.
        key_backspace: '^H', '\177'.
        key_c1: NULL, '\EOp'.
        key_c3: NULL, '\EOn'.
        key_dc: '\E[3~', NULL.
        key_enter: NULL, '\EOM'.
        key_f1: '\E[11~', '\EOP'.
        key_f10: '\E[21~', NULL.
        key_f11: '\E[23~', NULL.
        key_f12: '\E[24~', NULL.
        key_f13: '\E[25~', NULL.
        key_f14: '\E[26~', NULL.
        key_f15: '\E[28~', NULL.
        key_f16: '\E[29~', NULL.
        key_f17: '\E[31~', NULL.
        key_f18: '\E[32~', NULL.
        key_f19: '\E[33~', NULL.
        key_f2: '\E[12~', '\EOQ'.
        key_f20: '\E[34~', NULL.
        key_f3: '\E[13~', '\EOR'.
        key_f4: '\E[14~', '\EOS'.
        key_f5: '\E[15~', NULL.
        key_f6: '\E[17~', NULL.
        key_f7: '\E[18~', NULL.
        key_f8: '\E[19~', NULL.
        key_f9: '\E[20~', NULL.
        key_find: '\E[1~', NULL.
        key_ic: '\E[2~', NULL.
        key_mouse: '\E[M', NULL.
        key_npage: '\E[6~', NULL.
        key_ppage: '\E[5~', NULL.
        key_select: '\E[4~', NULL.
        orig_pair: '\E[m', '\E[0m'.
        parm_dch: '\E[%p1%dP', NULL.
        reset_2string: '\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>',
'\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h'.
        set_attributes: NULL,
'\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;'.

For me xterm-color works wrt function keys that in Vim if I hit the F1 key, I
also get Vim's help screen.  Confusing there is that Ctrl-V F1 results in the
^OP sequence, which is not what my terminfo says.  Could Vim do some special
handling here?
Comment 14 Fabian Groffen gentoo-dev 2009-10-28 07:56:14 UTC
ok, going by the differences:

XXXX
XXXX
XXXX
XXXX

If you see a 4 by 4 block of X's then (mir) should be true.
(mir) Move-in-insert-mode is true in the data base
(mir) Done 

ncv with value 37 just reports too much working which imo isn't.  The NULL value reports only normal and standout to work, which seems correct.

I've fixed my function keys with tack's function keys test.  At least these keys don't have special meanings on the Apple keyboard and work like this:
        kf16: '\E[29~', NULL.
        kf5: '\E[15~', NULL.
        kf6: '\E[17~', NULL.
        kf7: '\E[18~', NULL.
        kf8: '\E[19~', NULL.
Comment 15 Thomas Dickey 2009-10-29 00:59:37 UTC
For the end of comment #13 - the terminal description would
be for the application-mode keys, which isn't necessarily the
same as the default settings that you could see with ^V.
(xterm does have menu entries to switch this; I don't know
what Terminal.app may do).
Comment 16 Thomas Dickey 2009-10-29 08:32:35 UTC
I asked Benjamin Sittler (the contributor for nsterm*) for his opinion.
Briefly, he recommends updating nsterm-16color (rather than xterm-color).
Comment 17 Thomas Dickey 2009-11-01 12:04:00 UTC
Sittler sent me a set of updates for nsterm, which
I added yesterday.  There's a current terminfo.src
here:

http://invisible-island.net/datafiles/current/terminfo.src.gz

which renames the nsterm entry to nsterm-old, and adds a new
nsterm which should correspond to what you're seeing.
Comment 18 Fabian Groffen gentoo-dev 2009-11-01 13:34:37 UTC
Using nsterm with the terminfo.src you attached seems to make it behave fine for what I've seen so far with mutt and vim.
Comment 19 Thomas Dickey 2009-11-01 14:07:20 UTC
sounds good
Comment 20 Fabian Groffen gentoo-dev 2009-11-02 09:56:15 UTC
I just found out that with TERM=nsterm, visual mode in Vim (v, V or ^v) doesn't result in a inversed background any more (I think it's called standout?).  This is very bad, as you can't see what's being selected any more.  I think this correlates with the ncv (off the top of my head) test in tack that for the nsterm seems to define a wrong capability, e.g. blink doesn't blink at all in this terminal.
Comment 21 Thomas Dickey 2009-11-02 10:44:48 UTC
ncv might be related - a quick compare of nsterm/nsterm-old doesn't
show anything obvious for standout (smso/rmso).  To tell ncurses
that standout does not work, you might try adding ncv#1

Also, reverse might be the issue - so adding that to ncv, you'd
have ncv#5
Comment 22 Thomas Dickey 2009-12-22 10:09:49 UTC
I added updated nsterm entries - see

ftp://invisible-island.net/ncurses/current/
Comment 23 Fabian Groffen gentoo-dev 2011-12-15 17:23:45 UTC
I'm on Lion (10.7) these days, but also on Leopard (10.5) cursor hiding and showing again (civis, cnorm) seems to work fine under Terminal.app.

Considering this bug fixed.