stty erase issues on ssh to Linux after upgrade to Windows 7

Andy Koppe andy.koppe@gmail.com
Fri Apr 8 14:12:00 GMT 2011


On 7 April 2011 22:52, Tom Starr wrote:
> In Windows XP Cygwin erase defaults to ^H (backspace)

Actually Cygwin 1.7 defaults to ^? no matter the Windows version.
Cygwin 1.5 used ^H.


> which is
> preserved on ssh to Linux where backspace works in vi and in SQLPlus.
>
> In Windows 7 Professional erase defaults to ^? (delete) then changes
> to ^H on ssh to the same Linux

The ssh session should inherit the terminal settings from your local
terminal, including 'erase'. Works for me anyway. Perhaps have another
look through the relevant shell startup files on the Linux side,
including the global ones in /etc. You are using Cygwin ssh, right?


> And doing stty erase '^?' (or stty erase ctrl-v <backspace>) in Linux
> fixes vi but SQLPlus still gets little triangles.
>
> My TERM=ansi but I’ve also tried vt100 and cygwin - no change.

Which probably means that either SQLPlus is fixed to ^H or it relies
on terminfo, whereas ideally it should pay attention to the 'stty
erase' setting.

You could confirm this by finding a TERM setting that has ^? in the
kbs terminfo capability, e.g. using tput:

$ TERM=xterm tput kbs | cat -v
^?

Then try SQLPlus with that TERM setting. Note, however, that using the
Cygwin console (or any terminal) with an incompatible TERM setting
might cause other problems.


> I upgraded from Cygwin 1.5.25 to 1.7.9 based on 1.7.2 release notes
> stating the console's backspace keycode can be changed using 'stty
> erase' but no change.

Yeah, that turned out to be a bad idea, because some programs set the
erase character to NUL to disable it, which meant that the backspace
key sent NUL.

Hence in 1.7.5 this was replaced with support for the "DEC Backarrow
Key Mode" (DECBKM) control sequence, which can be used like this:

for ^H:  echo -ne '\e[?67h'
for ^?:  echo -ne '\e[?67l'

You'll still want to set 'stty erase' accordingly though.

You might also want to have a look at the mintty terminal, which uses
TERM=xterm, so things might work out-of-the-box. Otherwise, there's a
config dialog option for switching to ^H, which changes both the
backspace keycode and sets the erase character accordingly at startup.

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list