Home

Linux trivia - 2 bits on 1 bit in 0.x

I probably made the smallest ever contribution to the Linux kernel. In 1993, I emailed Linus Torvalds to ask if backspace in the Linux console's "IBM graphics" character mapping could just act like a normal backspace, and for the noblest of reasons - so that Nethack's IBMgraphics option would work. This required a change from "\010" to "\000" in the old console.c, i.e. a change of exactly one bit.

You can see the effect of the change easily enough, it seems to have been added in 0.99pl14. After the change the following command gives the traditional IBM PC smiley-face character then "ab" if run on a console:

 printf '\033)U\016\001aa\bb\017\n'

(My Raspberry Pi 400 still does this on the console in 2023, which hopefully means it was a decent suggestion.)

Kernels earlier than 0.99pl14 will show a different result, with the second "a" not being backspaced over and replaced, plus an extra character appearing. That was BS.

To see an earlier 0.99 kernel, you have to go right back to some very early Linux distributions like SLS 1.03, or Slackware 1.01. But it's not too hard to check this with e.g. QEMU, and with no need to slog through an old OS install.

Here's a command equivalent to the one above for Slackware 1.01's boot disk (which lacks printf):

(Slackware 1.01 in QEMU)

(The command needs a ^V prefix for each control code, which may not be obvious from the above.)

The equivalent for Slackware 1.12's boot/root setup (which also lacks printf and seems to use a different shell) is this, showing the change:

(Slackware 1.12 in QEMU)

Here's the command on my Pi:

(Raspberry Pi 400 version)

(The images above use 1-bit pixels, for greater contrast and maximum appropriateness.)

Nethack can still work in IBMgraphics mode on the console if you set the option, at least after running "unicode_stop":

(Nethack using IBMgraphics on the Pi)

Anyway, I thought it might be fun to document this silly bit of history.


Last updated on 2023 Jun 8