debian ubuntu terminfo hijinks
At work I have been using a macbook pro lately. I have been having this weird
issue where when I ssh to a remote box, and fire up screen, backspace stops
working properly. I can change the terminal property in OS X to send ^H, but
then things like telnet and nsupdate start to fail hard. No good!
So today I decided to work on it. I after some googling, I decided to ask phrakture for some of his terminfo mastery.
I got the TERM variable from the OSX box, and the remote box (which was a ubuntu gutsy install), and compared them.
$ echo $TERM xterm-color $ ssh remotebox $ echo $TERM xterm-color $ screen -R failwhale $ echo $TERM screen $ exit $ exitSo far so good. I got
xterm-colorfor local, remote, andscreeninside of remote screen.I wanted to see what the terms thought I was sending them. So locally, and remotely, and then remotely inside screen, I did a
C-v <backspace>. Locally and remotely I got^?for the backspace key. Remotely inside screen I got^[[3~.I checked my bash dotfiles to make sure I wasn't forcing any goofy things. I wasn't. yay!
phrakture had me test on an ArchLinux box. I have a few running, so this was no problem. The Arch box had no problem. Further, remotely in the Arch box and inside screen,
C-v <backspace>showed me^?. This was adingmoment for me, as I hadn't before noticed that only debian based systems presented this problem to me. It had never clicked until then. Not random!Next step was to look at the terminfo data for xterm-color. I had previously installed ncurses-term on ubuntu, so I had all the terminfos I thought I needed. I copied the ArchLinux terminfo for xterm-color to the ubuntu box, and put it in a home dir, so I could compare them easily with infocmp.
$ mkdir ~/.terminfo/a/ $ scp remote-arch:/usr/share/terminfo/x/xterm-color .terminfo/a/arch-xterm-color $ infocmp xterm-color arch-xterm-color comparing xterm-color to arch-xterm-color. comparing booleans. comparing numbers. comparing strings. hts: NULL, '\EH'. kdch1: '\177', '\E[3~'. kend: '\E[4~', NULL. kfnd: NULL, '\E[1~'. khome: '\E[1~', NULL. kslt: NULL, '\E[4~'.Whoah. That doesn't seem right, and phrakture agreed. Note the
kdch1values. Phrakture informed me thatkdch1is the backspace key.
Some additional googlitued turned up this bug report. Facepalms ensued. Thanks debian! :/
So how did I fix it?
$ mv .terminfo/a/arch-xterm-color /usr/share/terminfo/x/xterm-color
Now everything works great! I was pleased to find that I do not have problems ssh'ing from the ubuntu install that I changed this on, to other *nix boxen. I was afraid there would be some reliance inside the debian core on those odd terminfo values, but it didn't seem to hurt to remove them.