[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#97094: Summary of tty handling bug (bug #97094)

On Sat, May 12, 2001 at 05:04:44PM -0700, Thomas Bushnell, BSG wrote:
> Also, bash doesn't pay attention to echok or most tty bits, so people
> trying to test this should certainly be using cat or something stupid
> to read the input.

Bash uses readline for terminal handling, unless it is started with
--noediting.  Indeed does it then display the literal ^U after running
stty -echok.

This I found in the "readline" section of the bash(1) manpage:

     unix-line-discard (C-u)
            Kill backward from point to the  beginning  of  the
            line.  The killed text is saved on the kill-ring.

You might also try ash, which doesn't use readline.

I cannot reproduce the original problem with:

  $ gnome-terminal &

I can reproduce it with:

  $ gnome-terminal -e 'bash --noediting' &


  $ gnome-terminal -e 'ash' &

In both cases, Ctrl-U prints ^U on the screen.  Also in both cases, after
stty echok, it is fixed.

This raises the question to Taral: do you use a particularly odd shell, or
do you set any kind of non-default settings in your environment that could
possibly relate to the behaviour that you are seeing, while others don't?

BTW, I tested some more and found that in an xterm:

  $ stty
  speed 38400 baud; line = 0;
  -brkint -imaxbel

in gnome-terminal:

  $ stty
  speed 38400 baud; line = 0;
  eol = M-^?; eol2 = M-^?;

in aterm:

  $ stty
  speed 38400 baud; line = 0;
  lnext = <undef>;

I can't remember tweaking any of these terminal emulators, so I wonder
why the (iirc default) behaviours differ?

In particular, the -echok setting that gnome-terminal defaults to, appears
to break input behaviour of shells that rely on sane terminal settings.
IOW why or to what end does gnome-terminal turn off or not turn on some
of the sane terminal features?  

The stty(1) manpage defines "sane" as follows:

       sane   same as cread -ignbrk brkint  -inlcr  -igncr  icrnl
              -ixoff  -iuclc  -ixany  imaxbel opost -olcuc -ocrnl
              onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0
              vt0 ff0 isig icanon iexten echo echoe echok -echonl
              -noflsh -xcase -tostop -echoprt echoctl echoke, all
              special characters to their default values.

This implies that xterm is not entirely sane either (-brkint).

Does it sound very unreasonable to expect from a terminal emulator that
it provides a "sane" terminal environment by default?



Reply to: