rsbecker at 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
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 EnterYou 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 0abye, //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! ****************************************************
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 at greenie.muc.de