Mailing List Archive

Issues with a couple of keys
Anyone having problems with delete or backspace in ssh?

--
Member - Liberal International This is doctor@@nl2k.ab.ca Ici doctor@@nl2k.ab.ca
Yahweh, Queen & country!Never Satan President Republic!Beware AntiChrist rising!
Look at Psalms 14 and 53 on Atheism https://www.empire.kred/ROOTNK?t=94a1f39b
There are times when it is the traitor giving the orders. -unknown Beware https://mindspring.com
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Issues with a couple of keys [ In reply to ]
On Mon, 14 Mar 2022, The Doctor wrote:

> Anyone having problems with delete or backspace in ssh?

No, but this sounds like the age-old issue.

Make sure your tty settings match the termcap *and* terminfo
entries for your $TERM *and* match the actual terminal used
on the client.

More specific help depends on which client and server OS and
terminal is used.

bye,
//mirabilos
--
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

****************************************************
/?\ The UTF-8 Ribbon
? ? Campaign against Mit dem tarent-Newsletter nichts mehr verpassen:
 ?  HTML eMail! Also, https://www.tarent.de/newsletter
? ? header encryption!
****************************************************
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
RE: Issues with a couple of keys [ In reply to ]
On March 14, 2022 11:40 AM, Thorsten Glaser wrote:
>On Mon, 14 Mar 2022, The Doctor wrote:
>
>> Anyone having problems with delete or backspace in ssh?
>
>No, but this sounds like the age-old issue.
>
>Make sure your tty settings match the termcap *and* terminfo entries for your
>$TERM *and* match the actual terminal used on the client.
>
>More specific help depends on which client and server OS and terminal is used.

I have seen this for years, including having DEL and BS get into passphrases. I seriously thought this was a deliberate feature.

Cheers,
Randall

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Issues with a couple of keys [ In reply to ]
rsbecker@nexbridge.com wrote:
> Thorsten Glaser wrote:
> >The Doctor wrote:
> >> Anyone having problems with delete or backspace in ssh?
> >
> >No, but this sounds like the age-old issue.

Yes. The age-old issue.

Just recently I ran into a different user that had just switched to
using qterminal and hit this problem. It seems that qterminal (among
others) sends Control-H (BS) as the erase character instead of what
today I would call the ad-hoc standard DEL character. Which of course
causes problems. I was surprised that this was still "a thing" yet
here is a ticket on it.

https://github.com/lxqt/qterminal/issues/770

Also I was surprised that upstream XTerm also uses ^H instead of DEL
and had been protected from this by Debian patching it.

https://salsa.debian.org/xorg-team/app/xterm/-/blob/debian-unstable/debian/patches/900_debian_xterm.diff

Therefore it seems that this age-old issue is yet again still causing
problems. What's old is new again.

> >Make sure your tty settings match the termcap *and* terminfo entries for your
> >$TERM *and* match the actual terminal used on the client.
> >
> >More specific help depends on which client and server OS and terminal is used.
>
> I have seen this for years, including having DEL and BS get into
> passphrases. I seriously thought this was a deliberate feature.

Configurable tty parameters are a feature. But with power comes
responsibility. An earlier default was '#' which makes it difficult
to type in that key. But it is a configurable setting.

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.

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

The 7f is DEL (the 0a is linefeed LF from Enter) and my keyboard is
configured to produce DEL when pressing Backspace. On a different
terminal configured to emit BS this will be the result.

$ od -tx1
^H <-- Press the Backspace key, followed by Enter
^d <-- type in Control-D here to end input
0000000 08 0a

The 08 is the BS character. Again 0a is the LF from Enter.

The terminal erase character can be reset to normal. But if it is
bash/ksh/zsh/tcsh then one must quote it Control-V before pressing the
Backspace key so that it inserts the next key verbatim. Since those
ignore the tty erase parameter and always accept either for erase. On
strict sh though since the erase is not set pressing Backspace will
display ^? or ^H directly without quoting verbatim with Control-V
which is a ksh/bash/zsh/tcsh thing.

Easier just to exit the terminal and let it evaporate. Just exit it!
Open a new terminal which then uses the default erase again.

After determining the erase character sent by your terminal emulator
(does anyone use actual terminals these days?) then you can set it on
the system in the same way that it was set above to reset the terminal.

stty erase ^?
Or
stty erase ^H

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.

Bob
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Issues with a couple of keys [ In reply to ]
On Mon, 14 Mar 2022, Bob Proulx wrote:

> Also I was surprised that upstream XTerm also uses ^H instead of DEL
> and had been protected from this by Debian patching it.

OpenBSD used to switch between these every two releases… but AIUI
backspace = ^? and delete = ^[[3~ pretty much is standard now, over
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).

> $ 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).

> ^d <-- type in Control-D here to end input
> 0000000 7f 0a

bye,
//mirabilos
--
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

****************************************************
/?\ The UTF-8 Ribbon
? ? Campaign against Mit dem tarent-Newsletter nichts mehr verpassen:
 ?  HTML eMail! Also, https://www.tarent.de/newsletter
? ? header encryption!
****************************************************
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Issues with a couple of keys [ In reply to ]
On Mon, Mar 14, 2022 at 04:40:08PM +0100, Thorsten Glaser wrote:
> On Mon, 14 Mar 2022, The Doctor wrote:
>
> > Anyone having problems with delete or backspace in ssh?
>
> No, but this sounds like the age-old issue.
>
> Make sure your tty settings match the termcap *and* terminfo
> entries for your $TERM *and* match the actual terminal used
> on the client.
>
> More specific help depends on which client and server OS and
> terminal is used.
>

FreeBSD . Will check.

> bye,
> //mirabilos
> --
> Infrastrukturexperte ??? tarent solutions GmbH
> Am Dickobskreuz 10, D-53121 Bonn ??? http://www.tarent.de/
> Telephon +49 228 54881-393 ??? Fax: +49 228 54881-235
> HRB AG Bonn 5168 ??? USt-ID (VAT): DE122264941
> Gesch??ftsf??hrer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
>
> ****************************************************
> /???\ The UTF-8 Ribbon
> ???????? Campaign against Mit dem tarent-Newsletter nichts mehr verpassen:
> ??????? HTML eMail! Also, https://www.tarent.de/newsletter
> ???????? header encryption!
> ****************************************************

--
Member - Liberal International This is doctor@@nl2k.ab.ca Ici doctor@@nl2k.ab.ca
Yahweh, Queen & country!Never Satan President Republic!Beware AntiChrist rising!
Look at Psalms 14 and 53 on Atheism https://www.empire.kred/ROOTNK?t=94a1f39b
There are times when it is the traitor giving the orders. -unknown Beware https://mindspring.com
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Issues with a couple of keys [ In reply to ]
Hi,

On Mon, Mar 14, 2022 at 03:00:08PM -0600, 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...

> 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.

[..]
> 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 :-)

gert
--
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany gert@greenie.muc.de
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Issues with a couple of keys [ In reply to ]
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
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Issues with a couple of keys [ In reply to ]
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
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev