Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 869179

Summary: app-misc/tmux: TERM variable picked refers to a terminfo database missing in older distributions
Product: Gentoo Linux Reporter: Ben <ben.langenberg>
Component: Current packagesAssignee: Gentoo Shell Tools project <shell-tools>
Status: UNCONFIRMED ---    
Severity: minor CC: gentoo, kfm
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: emerge --info from my system

Description Ben 2022-09-08 12:10:47 UTC
Created attachment 803947 [details]
emerge --info from my system

When connecting to CentOS7 machines which are currently sadly spoken 90% of my working environment the Bash (4.2.46(2)-release) on the target complains with:

    user@centos-7-host ~ # less /etc/passwd
    WARNING: terminal is not fully functional
    /etc/passwd  (press RETURN)

    user@centos-7-host ~ # htop
    Error opening terminal: tmux-256color.

It can be workarrounded by setting the TERM var to something like "xterm". Reading in the CHANGELOG of tmux [1] I recognized that since 3.3a the maintainers automatically chose "tmux-256color" when nothing is set.
Obviously e.g. bash 4.2.46(2)-release can't handle this. Depending on the documentation it's possible to set `--with-TERM=` to the desired var during build. 

Outside of tmux my TERM var is set to

myHost ~ # echo $TERM

Is there any way to influence the var during the build process with some local ebuild flag or through a make.conf var?

It's also no problem to tweak around my tmux to always use xterm-256color like this:

    # hardcode for bash4 compat since tmux 3.3a
    set -g default-terminal xterm-256color

Honestly just HTH


Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-09 14:50:41 UTC
Could you try EXTRA_ECONF="--with-TERM=foo" emerge ...?

If that works, you can put that same EXTRA_ECONF="..." in /etc/portage/app-misc/tmux.
Comment 2 RumpletonBongworth 2022-10-11 10:08:54 UTC
This has nothing in particular to do with bash. With the assistance of libtinfo from ncurses, the less(1) utility performs a series of checks to determine whether all the capabilities expected for interactive usage are covered. To see this warning is symptomatic of a missing terminfo database. Your choice of login shell cannot possibly rectify such a situation.

Given that tmux is designed to be compatible with GNU screen, you could use "set -g default-terminal screen-256color". As Sam has mentioned, setting EXTRA_ECONF is another way of going about it.

I would add that you also have the option of copying the missing database(s) to whichever hosts need them. These are searched for in the directory specified by TERMINFO - which normally has an implicit default of /usr/share/terminfo - or the directories specified by TERMINFO_DIRS. See terminfo(5) for more information.