Technical Difficulties from on Top of the Mountain
  A look way under the hood
So I got Redhat 9 installed last night with David's help. I had pulled apart the machine and ripped out zip drive so that maybe the machine would boot from the cdrom before the hard drive. I also blew away the BIOS, taking care of the stupid SETUP password, and then at the last minute I thought to myself, "lets make sure the hard drive can't boot before the cdrom, lets pull its power."

So the first distro disk booted, and we got a RH screen up. Now someone at RH had done some thinking about what a user might be thinking if they put the distro disk in a machine without a harddrive, so the script had actually sidetracked us into the "verify the installation" tool, which was interesting. We decided, what the hey, and did the verify, which confirmed that yes this was a functional cdrom. At that point we backtracked in the menus, powered up the hard drive, and proceeded on our merry way doing the install. There was some question as to whether this would work, since as we had just blown away the BIOS settings, the BIOS didn't even have a record of the hard drive, but not to fear, it all worked just fine.

After playing around with the custom install settings, doing my own weird partition setup, and diddling install packages; we sent it on its way and it proceeded to install everything for the most part. (I thought I told it to install FTP, but we haven't seen any signs of it yet.) It finished, did its little reboot, and we were left with a brand new RH 9 install. Tada.

So I logged in from my PC where I do all my real work (not that I do real work on windows, but my best screen, a Sony W900, is hooked up to a windows 2000 machine, where I run the hummingbird extreme X server), and I fired up some xterm's after changing the default background color so I could tell the windows for grub apart from handspring. They came up just fine, but backspace wasn't working. It would blap, *beep*[3~ at me, and put more crud on the command line instead of covering up my typographical slip-ups.

Obviously, the problem was X11R6, since RH 7.3 was working just fine. Great, somebody decided they needed to *fix* something, and now I can't backspace, except by typing ctrl-h (which I can do, it's just more work). Do some quick checks on my xserver kbdmap, and also check xmodmap but everything seems fine there. Off to the web to waste my afternoon figuring this out.

The first page I found, didn't actually exist anymore, but the snippet on google looked so promising that I pried it out of its cache. The first thing I found is that because of the ultimate evil in the universe (emacs) wanted to use ctrl-h for help, they got everyone else to change what was a perfectly good coding standard. Ok, so now backspace is supposed to map to 0177 (which was delete), and delete is supposed to map to 'ESC [ 3 ~'. Well, I'm getting the escape sequence just fine, so clearly xterm has already been corrupted. I'm not seeing a 0177 or a BS, so something is still messed up. The article goes on to suggest a bunch of xterm keybinding settings, like:

! Fix xterm's keybindings
*VT100*translations:	#override
      BackSpace:    string(0x7F) \n
      Insert:       string(0x1b) string("[2~")\n
      Delete:       string(0x1b) string("[3~")\n
      Home:         string(0x1b) string("[1~")\n
      End:	    string(0x1b) string("[4~")\n
      Page_Up:      string(0x1b) string("[5~")\n
      Page_Down:    string(0x1b) string("[6~")
but like I said. I was already seeing that goofy sequence, so the problem was further down.

Switched over into digging into my code to check the routines that normally convert keysyms to ascii. The routine in question is XLookupString(), and you can sample both the raw event and the translated result with xev, so I tried that next. They were doing the right thing, getting BackSpace and Delete keysyms and translating BackSpace into a single character; so the problem was further down.

The next suspect was terminfo, but unfortunately the files in /usr/share/terminfo are no longer human readable, so that wasn't a lot of help. Back to google with some new keywords, and end up here: Consistent BackSpace and Delete Configuration. Sounds promising.

First neat trick, checking the terminfo data with infocmp. Turns out kbs=^H and kdch1=\177 which is what I would have expected before learning about the GNU corruption. Check what it was on my working system: kbs=\177, kdch1=\E[3~ Aha. So now I have three choices on fixing things: 1) unwarp the keyboard bindings, which would then break handspring; 2) hack the terminfo block, or 3) try and deal with the shell mapping layer.

Now the original paper had info on hacking bash through /etc/inputrc, but I don't use bash. I am a died in the wool csh user (though I have migrated to tcsh for a few modern conveniences, like command completion), but luckily the second document included the same instructions for tcsh. Basically there is a shell builtin bindkey which you can use to both dump out the current configuration and make changes. Its recommendations were:

      bindkey "\e[1~" beginning-of-line  # Home
      bindkey "\e[7~" beginning-of-line  # Home rxvt
      bindkey "\e[2~" overwrite-mode     # Ins
      bindkey "\e[3~" delete-char        # Delete
      bindkey "\e[4~" end-of-line        # End
      bindkey "\e[8~" end-of-line        # End rxvt
which would have been ok, except delete-char isdeprecated. Ok, search the existing list of 120+ lines for delete: its now called backward-delete-char, obviously so you don't confuse it with forward-delete-char, I guess. Hmmm, but there's no forward-delete-char in the list. Ah, it must be the new delete-char-or-list-or-eof. Is this making sense to anybody else? Never mind, fix delete and end (which was also messed up, but for some reason home wasn't). Now I can get back to my regularly scheduled attempt at getting paying work done.
Comments: Post a Comment

<< Home
Life in the middle of nowhere, remote programming to try and support it, startups, children, and some tinkering when I get a chance.

January 2004 / February 2004 / March 2004 / April 2004 / May 2004 / June 2004 / July 2004 / August 2004 / September 2004 / October 2004 / November 2004 / December 2004 / January 2005 / February 2005 / March 2005 / April 2005 / May 2005 / June 2005 / July 2005 / August 2005 / September 2005 / October 2005 / November 2005 / December 2005 / January 2006 / February 2006 / March 2006 / April 2006 / May 2006 / June 2006 / July 2006 / August 2006 / September 2006 / October 2006 / November 2006 / December 2006 / January 2007 / February 2007 / March 2007 / April 2007 / June 2007 / July 2007 / August 2007 / September 2007 / October 2007 / November 2007 / December 2007 / January 2008 / May 2008 / June 2008 / August 2008 / February 2009 / August 2009 / February 2010 / February 2011 / March 2011 / October 2011 / March 2012 / July 2013 / August 2013 / September 2013 / October 2013 / November 2013 / December 2013 / December 2014 / February 2015 / March 2015 / July 2016 / September 2016 / December 2016 / April 2017 / June 2017 / July 2018 /

Paul Graham's Essays
You may not want to write in Lisp, but his advise on software, life and business is always worth listening to.
How to save the world
Dave Pollard working on changing the world .. one partially baked idea at a time.
Eric Snowdeal IV - born 15 weeks too soon, now living a normal baby life.
Land and Hold Short
The life of a pilot.

The best of?
Jan '04
The second best villain of all times.

Feb '04
Oops I dropped by satellite.
New Jets create excitement in the air.
The audience is not listening.

Mar '04
Neat chemicals you don't want to mess with.
The Lack of Practise Effect

Apr '04
Scramjets take to the air
Doing dangerous things in the fire.
The Real Way to get a job

May '04
Checking out cool tools (with the kids)
A master geek (Ink Tank flashback)
How to play with your kids

Powered by Blogger