Bug 91357 - bashrc breaks stty erase
Summary: bashrc breaks stty erase
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: setup
Version: 9
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
Depends On: 98752
TreeView+ depends on / blocked
Reported: 2003-05-21 20:33 UTC by Marc MERLIN
Modified: 2014-03-17 02:36 UTC (History)
4 users (show)

Clone Of:
Last Closed: 2003-12-08 19:32:31 UTC

Attachments (Terms of Use)

Description Marc MERLIN 2003-05-21 20:33:01 UTC
# I'm seeing this wrongly reset stty erase to ^H when it was ^? and the terminal
# was sending ^? too. Disabling this fixes the problem -- merlin
#    if [ -x /usr/bin/tput ]; then
#      if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal
#        stty erase `tput kbs`
#      elif [ -x /usr/bin/wc ]; then
#        if [ "`tput kbs|wc -c `" -gt 0 ]; then # We can't do this with "dumb"
#          stty erase `tput kbs`
#        fi
#      fi
#    fi

This code would break erase inside screen for some users, or for me when I
logged in remotely.
tput kbs returned ^H when in all cases backspace generated ^?

I'm really not sure what cases the code is supposed to help with, but backspace
mapped to ^H is a thing of the past, you should concentrate on making sure that
all apps generate ^?, and leave things alone.
(it pains me when users ask me why backspace is _still_ broken in linux when
we've had more than 10 years to fix it)

If I'm missing something, let me know


Comment 1 Marc MERLIN 2003-06-03 22:52:21 UTC
I found that the problem is mostly because you have a nonstandard screenrc which
generates ^H instead of ^?, and you try to account for that.
IMO, this is the wrong way to do it, if that's the only reason you have the
above code.

You use this:
# This makes screen treat backspaces '^?' as
# deletes. There should be a fix in the code
# for the way termcap inheritance works,
# but I dont know where to put it, and this works.
bindkey -d -k kb stuff "\010"

Debian, and most other folks use that:
bindkey -k kb stuff "\177"

The second way is consistent and generates ^?.

Your way works for screen run on the local machine, but if I run screen on a
remote machine (not running RH), screen generates ^? (as it should), and your
bashrc code changes stty erase to ^H, causing backspace not to work.

Unless I missed something, I don't see why you're trying to support BS set to ^H
when it's been abandonned in all of linux years ago.

Comment 2 Lon Hohberger 2003-06-06 13:15:39 UTC
As it turns out, neither are correct.

Distributions, in general, should not change the default backspace key binding
in /etc/screenrc.  Additionally, Screen ships with the backspace key defined as
'^H' in its termcap and terminfo settings; Debian modifies these to '^?'.  I am
not sure if this might also be causing problems for you (and others) or not.

I'll look into fixing screen as it ships with Red Hat Linux, but I consider it
unlikely that this will fix compatibility problems with other distributions
which ship with broken default settings.

Comment 3 Lon Hohberger 2003-07-02 14:54:32 UTC
Packages which do not have the 'bindkey' entry in /etc/screenrc are (or will be)
in rawhide shortly, and are also available from the URLs below.


The above packages will *not* fix inter-operating system conflicts caused by
modified terminfo/termcap entries.

Comment 4 Lon Hohberger 2003-07-10 20:00:40 UTC
Unfortunately, I still have reports that removing this bindkey line breaks some
configurations, (though I have been unable to reproduce it myself).  Thus, I
will re-break screen for the time-being, and work on this after my vacation.

Comment 5 Micha Wiedenmann 2003-09-28 15:12:25 UTC
You meight want to read http://www.ibb.net/~anne/keyboard.html

The Debian Policy states that BS must send ^?, that is why ther terminfo entry
is changed.

If BS sends ^H, then C-h (as used eg. by Emacs) is not distinguishable from BS
and it is difficult to explain users, why BS generates help, etc.


Comment 6 Marc MERLIN 2003-10-24 06:49:00 UTC
I just don't understand why you are going through all that trouble to deal with
the fact that screen ships with a broken default of setting BS to ^H

Everyone else fixes this by doing the following:
in /etc/screenrc: bindkey -k kb stuff "\177"
in /etc/bashrc: don't muck with tput, just leave stty erase to ^?

The current RH config (BS=^H in screen but ^? everywhere else) is not only
complex, makes no sense to me, and doesn't work with escreen on a RH 9 machine
to another RH 9 machine.
Doing the above does fix the problem, and that's what other distros do AFAIK

Comment 7 Lon Hohberger 2003-10-29 15:47:51 UTC
There is light at the end of the tunnel on this 3-year-old issue; screen-4.0.1.
I've packaged it up and placed it on my web page.  You can point 'yum' at:


or just download the packages directly:


Once you install this package, you need to comment out the 'stty erase `tput
kbs`' from /etc/bashrc and /etc/zshrc.  Screen should work as it did previously
on Red Hat Linux, Red Hat Enterprise Linux, and Fedora Core - except that the
backspace key is handled by the parent terminal's settings and inherited by
Screen (the way it's supposed to work).

NOTE: This is not an official package; I want to get it out there for testing. 
If it tests out well, I'll work with the shell maintainers to have the 'stty'
hack removed (if applicable) - which would then cause this bug to [finally] be

Comment 8 Lon Hohberger 2003-12-08 19:19:54 UTC
New (Fedora) package - screen-4.0.1-2.i386.rpm will appear in rawhide
soon.  This package does *not* have a bindkey default, as per the
screen maintainer's recommendation.  For now, you can retrieve the
proper RPMs using yum from my repository:


Or directly:


** Note: You will need to comment out the block which executes "stty
`tput kbs`" in /etc/bashrc if you are using setup <= 2.5.27-1.1

Changing component to "setup" (which owns /etc/bashrc)

Comment 9 Bill Nottingham 2003-12-08 19:32:31 UTC
Added in 2.5.28-1, will be in rawhide tomorrow.

Comment 10 Bill Nottingham 2003-12-08 19:33:00 UTC
Erm, 2.5.30.

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