A Minsky machine in ncurses terminfo
ncurses terminfo parameter expansion can implement a Turing-complete 2-counter Minsky machine, allowing programs like Fibonacci generators to run inside terminal capability definitions.
read it A clever technical deep dive into an obscure subsystem that rewards reading for its unique abuse of terminal metadata.
summary
The author demonstrates that ncurses terminfo parameter expansion includes arithmetic, conditional logic, and persistent registers, making it Turing-complete via a reduction from a Minsky machine. By defining custom capability rules like cup, stateful programs such as an adder or Fibonacci sequence generator can be executed through repeated expansions. These parasitic programs can be clocked by host utilities like top without presenting privilege escalation risks.
key points
- Terminfo parameter expansion features registers, arithmetic, and conditional statements across 52 available registers.
- A program counter and conditional chains map directly to a two-counter Minsky machine, proving computational universality.
- External programs like top can clock these parasitic routines by repeatedly triggering terminal capability queries.
who should read it
Systems engineers and esolang enthusiasts interested in unusual uses of standard configuration layers.
discussion mixed
consensus
Commenters agree that terminfo is an overly complex, obsolete legacy system from physical terminals, with modern terminal emulators mostly bypassing it by claiming to be xterm-256color.
pushback
A minority point out that newer control sequences allow direct capability querying, though widespread adoption remains low.
Terminfo was never a particularly good idea, but in today's day and age it has become simply ridiculous. Its original purpose was to store data about actually manufactured physical terminals, and so it was okay that it was a fixed DB (as opposed to interactively querying the terminal for its capabilities somehow).
These days though, terminals are all software. It would be very easy to just ask them. Instead we still insist on shipping a fixed terminfo or termcaps DB. As a consequence, every new terminal emulator is not in there, and so in order to give their users a tolerable experience, …
It critiques the fixed-database design of terminfo in the context of modern software and virtual terminal emulators.
Generated by an LLM from the article and thread. Check the sources before relying on it.