Hi,

This spurious ^C was introduced on purpose:

  $ zgrep -B 7 "previous version, bash-3.2-release" 
/usr/share/doc/bash/CHANGES.gz 
  4.  New Features in Readline
  
  a.  If the kernel supports it, readline displays special characters
      corresponding to a keyboard-generated signal when the signal is received.
  
  ------------------------------------------------------------------------------
  This document details the changes between this version, bash-4.0-alpha,
  and the previous version, bash-3.2-release.

One way to avoid is to disable echoctl in your terminal:

  stty -echoctl

However, that's strongly undesirable because it changes the behavior
of all control characters, not just the ones that cause an interrupt.
For example, run "sleep 100" and hit the arrow keys after running both
"stty echoctl" and "stty -echoctl", and notice the difference.

For those of us who want the normal behavior back, please apply the
below patch (against bbash 4.0).  It will add a new readline option,
"disable-signal-echo".  To enable it, add in ~/.inputrc

  set disable-signal-echo on

Then restart bash and the old behavior should be back.

I would also like to suggest that the old behavior should be the
default behavior.  Keyboard controls that generate a signal are
special -- it's silly and unhelpful for bash to purposely output these
characters when it receives a signal.

-jim

ps. I just realized that something similar should probably be applied
to readline too...



diff -ur bash-4.0/lib/readline/bind.c bash-4.0-jim/lib/readline/bind.c
--- bash-4.0/lib/readline/bind.c        2009-01-22 20:15:57.000000000 -0500
+++ bash-4.0-jim/lib/readline/bind.c    2009-10-27 18:04:28.000000000 -0400
@@ -1419,6 +1419,7 @@
   { "completion-ignore-case",  &_rl_completion_case_fold,      0 },
   { "convert-meta",            &_rl_convert_meta_chars_to_ascii, 0 },
   { "disable-completion",      &rl_inhibit_completion,         0 },
+  { "disable-signal-echo",     &_rl_disable_signal_echo,       0 },
   { "enable-keypad",           &_rl_enable_keypad,             0 },
   { "expand-tilde",            &rl_complete_with_tilde_expansion, 0 },
   { "history-preserve-point",  &_rl_history_preserve_point,    0 },
diff -ur bash-4.0/lib/readline/rlprivate.h bash-4.0-jim/lib/readline/rlprivate.h
--- bash-4.0/lib/readline/rlprivate.h   2009-01-22 21:56:49.000000000 -0500
+++ bash-4.0-jim/lib/readline/rlprivate.h       2009-10-27 18:05:09.000000000 
-0400
@@ -434,6 +434,7 @@
 extern int _rl_interrupt_immediately;
 extern int volatile _rl_caught_signal;
 
+extern int _rl_disable_signal_echo;
 extern int _rl_echoctl;
 
 extern int _rl_intr_char;
diff -ur bash-4.0/lib/readline/signals.c bash-4.0-jim/lib/readline/signals.c
--- bash-4.0/lib/readline/signals.c     2009-01-23 10:57:00.000000000 -0500
+++ bash-4.0-jim/lib/readline/signals.c 2009-10-27 18:05:33.000000000 -0400
@@ -102,6 +102,7 @@
 int volatile _rl_caught_signal = 0;    /* should be sig_atomic_t, but that 
requires including <signal.h> everywhere */
 
 /* If non-zero, print characters corresponding to received signals. */
+int _rl_disable_signal_echo = 0;
 int _rl_echoctl = 0;
 
 int _rl_intr_char = 0;
@@ -586,7 +587,7 @@
   char cstr[3];
   int cslen, c;
 
-  if (_rl_echoctl == 0)
+  if (_rl_echoctl == 0 || _rl_disable_signal_echo)
     return;
 
   switch (sig)



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to