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