Issues with a couple of keys
Bob Proulx
bob at proulx.com
Tue Mar 15 10:14:52 AEDT 2022
Gert Doering wrote:
> Bob Proulx wrote:
> > To help, and to confuse, the very popular bash command line shell
> > accepts either BS or DEL for erase regardless of tty setting. Which
> > tells me that is not the command shell on the remote system.
>
> This is actually a huge part of "the problem", because it hides
> misconfigurations - up to the point where you type something into
> a program or a password prompt, and all of a sudden the "wrong"
> delete-to-left character ends up as part of the typed-in sequence...
YES!!! That summarizes the problem exactly.
> > To make this more useful for The Doctor try determining what erase
> > character is being sent by your terminal emulator. Set it to
> > something different such as @ and then type into od and have it
> > print out the raw hex value of the key from the keyboard being
> > pressed.
> >
> > $ stty erase @
> > $ od -tx1
> > ^? <-- Press the Backspace key, followed by Enter
> > ^d <-- type in Control-D here to end input
> > 0000000 7f 0a
>
> $ echo <ctrl-v><the-key> | od -x1
>
> also works and needs no "stty" change.
I worried that the remote shell which was reported, which did not
handle either of BS or DEL as erase and therefore could not have been
any of the shells bash, ksh, zsh, tcsh and therefore may have been the
dash shell often linked to sh and used for a root shell and that does
not have that behavior and would not handle Control-V. Or would be on
a system such as HP-UX which does not have the lnext literal next
feature of the tty driver that today I learned about. In which case
this would result. And then I would feel compelled to explain away
the possibly-there possibly-not-there 16 for the Control-V.
# echo ^V^H | od -tx1
0000000 16 08 0a
That's why I used what I thought was the most robust recipe for
entering the Backspace character emited from the terminal into 'od'.
Since I have no idea what system The Doctor was ssh'd into that had
this issue.
> > In the old days we would have to put this in a case statement based
> > upon our $TERM setting and other hints so as to select the right thing
> > for that terminal. Those were dark bad days indeed. I had hoped to
> > never see those days again hoping that DEL (^?) had won.
>
> I'm in the ctrl-H camp :-)
I find Control-H useful for other things. It's a good help key. But
this is a customizable setting and each to their own! ykinmkbykiok. :-)
I am just happy that we are not using paper tape, needing to backspace
using ^H BS back to the characters of the mistake we just made typing
in the punch that we wish to delete, and then overwriting the
mistakenly punched characters with DEL characters punching out all of
the 7-bit holes with 0x7F so that they are deleted, and then typing in
new characters after that point of the mistake. The reader reading
the tape back in will ignore the DEL characters on input and so they
are effectively deleted from the input stream. At that time both keys
were required, one to backspace and one to delete, and both were used
in coordination with each other. I just wish that when we moved to
electronic displays that everyone had chosen the same erase character!
But such is life.
Meanwhile... I just recently heard from someone who said they were
still using a very old C&C milling machine that was still programmed
and running using paper tape. Wow!
Bob
More information about the openssh-unix-dev
mailing list