Bug 6358 - Xterm sets erase wrongly on tty
Xterm sets erase wrongly on tty
Product: Red Hat Linux
Classification: Retired
Component: xterm-color (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Preston Brown
Depends On:
  Show dependency treegraph
Reported: 1999-10-25 19:56 EDT by erik
Modified: 2008-05-01 11:37 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-01-18 15:12:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description erik 1999-10-25 19:56:51 EDT
Xterm reads its termcap entry in order to set stty erase to
the correct value.  The correct value is 'stty erase ^H'
since that is what xterm by default produces for a BackSpace
keysym, and that is what the termcap/terminfo entries say
(kb/kbs).  Unfortunately, xterm reads the wrong termcap
entry (kD equivalent to terminfo entry kdch1) and sets the
tty erase character to ^?.  This means programs that don't
autocompensate (cat, ftp, anything not linked to readline)
get confused and you can't delete with the expected button.
And programs that use readline lose the ability to delete to
the right (delete the character under the cursor) which is
the real meaning of kdch1 as per the terminfo docs (and what
any new user would expect).  This could otherwise be
achieved with a line
DEL: delete-char
in /etc/inputrc.

I linked to a patch that fixes it.  According to the xterm
FAQ on http://www.clark.net/pub/dickey/xterm/xterm.faq.html
this is the way it was originally, don't know who broke it,
but they didn't read the kD entry on man 5 termcap first.

An additional problem is that the xterm termcap entry would
be over 1023 characters, so it is truncated when converting
from terminfo.  This means that the kD (kdch1) info is
missing (doubly ironic when xterm tries wrongly to read it
to set the tty), so xterm does not know how to send the data
from the Delete key.  Xterm sends ^?, while apps that read
terminfo will expect ^[[3~ like on the linux console.  This
is a smaller problem since the line above will fix things
for readline apps that make up the majority of apps that
would know what to do with the delete key anyway.
Comment 1 erik 1999-10-26 05:23:59 EDT
I forgot to mention, you have to reverse the 'aaargh' patch to the
latest termcap (2.0.8-18) before xterm can see the termcap entry at
all.  The aaargh patch breaks the API.  Probably should be redone so
it works the old way unless the TERMCAP entry is overlong.  Not sure
what it was supposed to fix, anyway.
Comment 2 Bill Nottingham 1999-10-26 11:11:59 EDT
It's a security fix; it will most likely *not* be reverted.
Comment 3 Preston Brown 2000-01-18 15:12:59 EST
xterm terminfo stuff fixed for next release.

Note You need to log in before you can comment on or make changes to this bug.