ui/ncurses: Safely handle lost terminal control commands v1.6.3
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 30 Oct 2017 23:49:51 +0000 (10:49 +1100)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 14 Nov 2017 05:33:41 +0000 (16:33 +1100)
commit8d1e4f053574d69aae89af19983c96500b4156a4
tree190c566638fac6bbcc7964566cbe75e6d05d3fff
parent669083ee9eda63af65d7cfc43968947f09162996
ui/ncurses: Safely handle lost terminal control commands

Normally terminal control commands are caught and handled before ncurses
or Petitboot could see them. However several combinations of broken
terminal emulators or console connections can cause these command
sequences to be seen by Petitboot, usually resulting in Petitboot
exiting due to the ESC character and then the rest printed to the
console.

Aside from confusing the user this can also cancel autoboot, so it's
important we don't let these sequences go unnoticed if possible.
In ui/ncurses/console-codes we add a state machine that recognises the
syntax of these control/escape sequences and handles the lost
characters. We don't try to emulate the functionality of these commands,
instead just logging them for reference.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Makefile.am
test/ui/Makefile.am [new file with mode: 0644]
test/ui/console-sequence.c [new file with mode: 0644]
ui/ncurses/Makefile.am
ui/ncurses/console-codes.c [new file with mode: 0644]
ui/ncurses/console-codes.h [new file with mode: 0644]
ui/ncurses/nc-cui.c