Issues with a couple of keys
Bob Proulx
bob at proulx.com
Tue Mar 15 09:55:20 AEDT 2022
That we haven't mentioned ssh yet shows that this really is not an ssh
problem. But it is a problem people run into while using ssh. So I
am barging forward for a bit longer.
Thorsten Glaser wrote:
> OpenBSD used to switch between these every two releases… but AIUI
> backspace = ^? and delete = ^[[3~ pretty much is standard now, over
That delete would usually be identified as the associated keypad
Delete intending to delete characters ahead rather than Backspace
intending to erase characters behind. It's part of the keypad which
is why it is an escape sequence rather than a single key. That is
another age-old issue.
> backspace = ^H and delete = ^? (except ^H is usually accepted for
> backspace, too, although at a different layer which totally is useful,
> and lynx still handles delete as backspace).
Application programs such as lynx and bash and others often will be
configured to accept either. I imagine just to silence the bug report
tickets to them that are not their problem. But that's at the
individual program level and not the line discipline driver level.
> > $ stty erase @
> > $ od -tx1
> > ^? <-- Press the Backspace key, followed by Enter
>
> You probably need to press ^V before the backspace key
> (but then can do this without stty’ing first).
I did not know about the tty driver lnext handling for a literal next
character. TIL that it does seem to be pervasive now. I'll claim it
is "new" since it did not appear in v7 nor does it appear in HP-UX
where I spent many years working.
Therefore I was careful with the handling and the above example does
not require a Control-V at that point because I set the erase
character to something that was neither BS nor DEL. The bash shell,
and ksh, zsh, and tcsh shells, all accept either BS or DEL and
therefore those set of command line shells need Control-V before the
Backspace key in order to accept it verbatim. If I had tried to echo
it then it would have been needed since it would have been interacting
with the command line shell.
But when the 'od' program is reading keystrokes from standard input
there is only the tty line driver handling of erase. And setting
erase to @ as as in the demonstration case meant that we would see the
BS or DEL without the tty driver handling it. (Because I did not
previously know about the lnext literal next character tty driver
handling. I'll mark that TIL.)
Bob
More information about the openssh-unix-dev
mailing list