I have TERMINFO set because I keep some modified terminfos. When I try to run lf in a tmux session, it exits with return code 1 and no output. The log has a line with
initializing termbox: termbox: error while reading terminfo data: termbox: unsupported terminal
lf runs if I unset TERMINFO, or set TERM to something that starts with xterm, or set it to one of my modified terminfos. I shouldn't have to.
$ echo $TERM
tmux-256color
$ lf # error
$ TERMINFO= lf # no error
$ TERM=xterm-256color lf # no error
$ TERM=tmux-256color-less lf # no error
I have reproduced this with openbsd-amd64, and on linux-amd64 with arch linux and alpine linux.
@ncoop Thanks for reporting this issue.
This is likely not specific to lf but to termbox-go in general which seems to skip other directories to search when TERMINFO is set as implemented here. We can try to raise an issue in termbox though this may not be considered a bug since this is already the behavior described in terminfo(5). On my system it says:
If the environment variable TERMINFO is set, it is interpreted as the pathname of a directory containing the compiled description you are working on. Only that directory is searched.
I think the easiest solution would be to store your modified terminfos in ~/.terminfo or use TERMINFO_DIRS variable instead for your custom location.
On a related note, I remember this was also an issue with kitty terminal which sets TERMINFO to a custom location including xterm-kitty database but not tmux-color256 database and so termbox applications fail to run when kitty is used with tmux. The workaround for this is to unset TERMINFO or use aliases for lf and lfcd like the following:
TERMINFO=
# or
alias lf='TERMINFO= lf`
alias lfcd='TERMINFO= lfcd`
These can be put in ~/.bashrc or similar.
I ended up setting TERMINFO_DIRS instead of TERMINFO in my shell profile. (You can just append a : and the default path is implied.) termbox is being strict and that seems to be the right solution.
Still, it wouln't hurt to write something informative to stderr when termbox barfs.
@ncoop I am glad to hear that it worked out somehow. You are actually quite right about writing something to stderr when termbox fails to initialize. I had tried to initialize logging as early as possible to not spit error messages to the terminal. However, in this case, it is better to print the error messages to the terminal instead of the log file. I have now pushed a commit to do that. Hopefully the error message should guide the users in the right direction for this issue. Closing this issue now.
I think the easiest solution would be to store your modified terminfos in
~/.terminfoor useTERMINFO_DIRSvariable instead for your custom location.
@gokcehan I have the same issue & my modified terminfos is already in ~/.terminfo (_symlinked though from my dotfiles_) & I'm still getting this error _only_ when I'm inside a tmux session.
echo $TERM is the following
Outside tmux: xterm-kitty, works fine.
Inside tmux: tmux-256color, <-- errors on this one
And as you can see from infocmp, the modified terminfo is coming from ~/.terminfo
# Reconstructed via infocmp from file: /Users/ahmed/.terminfo/74/tmux-256color
tmux-256color|screen with 256 colors and italic,
am, km, mir, msgr, xenl,
colors#256, cols#80, it#8, lines#24, ncv#3, pairs#32767,
acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M,
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM,
cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0,
flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@,
il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kbs=\177,
kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
ritm=\E[23m, rmacs=^O, rmcup=\E[?1049l, rmir=\E[4l,
rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m,
rs2=\Ec\E[?1000l\E[?25h, sc=\E7,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
sgr0=\E[m\017, sitm=\E[3m, smacs=^N, smcup=\E[?1049h,
smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m,
tbc=\E[3g,
The original issue reported by @uppercat and probably also the one reported by @ahmedelgabri should now work with the latest patch by @doronbehar.