Zsh Mailing List Archive
Messages sorted by:
Re: zsh, ctrl-something, and recent kernels
- X-seq: zsh-users 9882
- From: "Brian K. White" <brian@xxxxxxxxx>
- To: <zsh-users@xxxxxxxxxx>
- Subject: Re: zsh, ctrl-something, and recent kernels
- Date: Sun, 5 Feb 2006 06:44:51 -0500
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: Aljex Software
- References: <43E523EA.9050506@xxxxxxxxxxxxx>
----- Original Message -----
From: "Nathan Grennan" <zsh-users@xxxxxxxxxxxxx>
Sent: Saturday, February 04, 2006 5:00 PM
Subject: zsh, ctrl-something, and recent kernels
I have a problem with zsh and recent kernels when I try to use ctrl-c or
ctrl-z. It seems to have started after 2.6.16-rc1-git4. I can currently
see it in 2.6.16rc2. I started with zsh-4.2.5 and I have tried 4.2.6 too.
I sort of tried 4.3.0 cvs, and it didn't seem to work either. But since I
couldn't get it packaged, and had errors with it, I am not sure with it.
The behavior seems to have changed with the recently kernel releases.
When I first noticed
it I could ctrl-c repeatedly until I ran ls | less and then quit out. Now
if I just try to ctrl-c a second time at the prompt ctrl-c stops working.
If I go back to 2.6.16-rc1-git4 or older it works every time. I suspect it
is a bug or bugs in signals.c.
I originally thought it was a kernel bug, in that if I ran bash from zsh
I had the same problem. Today I tried bash directly and it works on the
latest kernel releases. It still could be a bug in the kernel, but I
suspect it is just a change in behavior of the kernel and zsh needs to
deal with it. The url for my bug report to Red Hat is below.
First off, "recent kernels" is meaningless.
I have very recent FreeBSD and SCO Open Server kernels that do not display
any such problem with any version of zsh.
Secondly, "ctrl-c" is likewise meaningless, at least until we establish that
the kernel in question must be Linux, and that you haven't used stty to
change the interrupt key from it'sdefault.
Thirdly, unlike the 2 points above which can be deduced because eventually
at the end you mentioned RedHat, another important fact can't be deduced,
which is what kind of terminal (or trail of terminals) is this failure
appearing on? The console? xterm? rxvt/gnometerm/other xterm-alike? one of
the bezillion windows terminal emulators? and the communication layer? ssh?
telnet? rlogin? serial? local socket? X over tcp-ip? Vnc? Several of the
above thus eliminating any one as the culprit?
Using all three of putty over ssh, the console, and rxvt, on all three of
freebsd, sco open server, and suse 10.0 (linux 2.6.13 smp kernel) (9
different tests), I do not see a problem with the break key (no mater what I
set "intr" to, including ctrl-c)
So, it sounds like a tty driver bug in recent linux kernels to me, not
anything even within zsh's possibility to control or work around, let alone
be obligatd to.
It's the terminals job to read the physical keyboard and keep track of such
things as the state of the various mode shifting meta keys and translate
some actions into other things.
It's the tty drivers job to recognize and interpret some sequences and
translate them into other things or otherwise act upon them, while still
being considered input.
It's the kernels job or the server side communication daemon (sshd, telnetd,
etc...) 's job to send signals to the child processes like zsh.
zsh merely has to trap the signal, which if it does on any platform then
it's doing it. If a recent linux kernel changed to cause this, then that
kernel changed away from doing the right thing to doing the wrong thing and
it's the kernel that needs to change back.
Try setting intr to a plain single character like ~, or one that doesn't
need any meta keys, not even the shift key, like . or , or ' or `
(obviously once you do that you have to be careful to avoid commands that
need the character you chose) and use cat -v (why I didn't suggest - as a
new break key) and see what happens when you press ctrl-c [enter] once,
twice, three times. You should see ^C for each time you press ctrl-c, but
you don't see anything until you press Enter, then you see everything that
happenes since the last Enter. (or ctrl-m for that matter!)
You could use ctrl-v followed by ctrl-c right on the zsh command line, but
it's stupid to try and use a ctrl key it to diagnose a problem that might be
with ctrl keys in general. Maybe ctrl-v also only works once. Or maybe
ctrl-anything, such that the ctrl-v would work, and then the immediately
following ctrl-c doesn't. The stty change only lives for the duration of
that session and only effects that session, it's completely safe.
If you don't see ^C the 2nd or 3rd times, then something is wrong way before
zsh can do anything about it.
If you do see a ^C for every time you press it then it's a little more
In that case, start a new session without running stty, press ctrl-c until
it stops working, then run stty intr "^c", and then press ctrl-c again. Does
the stty reset the ctrl-c so that it works one more time?
Start another new session and run "stty -a >stty.a"
Then press ctrl-c until it stops working
Then run stty -a >stty.b
Then diff -u stty.a stty.b
Do stty.a and stty.b differ at all?
Do the same test under bash and ksh. (if ctrl-c never stops working n bash
or ksh, then just press it however many times it takes for it to stop
working in zsh.)
Do stty.a & .b differ under zsh but not under other shells?
Try running bash from within bash. Does ctrl-c fail in the child bash but
not in the parent?
Try running bash as a child under zsh. Does the child-of-zsh-bash still
Try setting a users login shell to zsh (as opposed to running zsh manually
after logging in to a login shell of bash). Does ctrl-c still fail then?
Try other shells besides just bash & zsh. try ksh (or pdksh) ash, csh etc...
There may be a quirk where something is wrong but just bash happens to work
anyway. Like maybe the wrong signal is being sent after the first time, but
maybe bash just happens to trap that other signal too, and just happens to
treat it similarly to break (ctrl-c).
For that matter, you could do this:
n=0 ;until [ $n -gt 15 ] ;do trap "echo $n" $n ;((n++)) ;done
Then press ctrl-c a few times.
On a properly working terminal you should see "2" every time you press
"break" ie ctrl-c in your case.
If you stop getting new 2's, or start getting something else, then the os or
possibly the server communication daemon is broken.
Try the same thing in bash. ksh.
Try the same thing under different server daemons (ie: telnet, rlogin,
directly at the console, an xterm window, etc.. instead of opensshd)
Brian, who is annoyed by people who forget that the universe is not linux.
At least by using zsh you automatically avoid the similar annoyance of
people who think all "sh" everywhere is bash and write scripts accordingly.
Brian K. White -- brian@xxxxxxxxx -- http://www.aljex.com/bkw/
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
Messages sorted by: