[Pkg-zsh-devel] Bug#684197: zsh doesn't handle SIGINT correctly when trapped in a child

Vincent Lefevre vincent at vinc17.net
Tue Aug 7 17:23:43 UTC 2012


Package: zsh
Version: 4.3.17-1
Severity: normal

zsh doesn't handle SIGINT correctly when trapped in a child,
except when this is the last command that is interrupted
(probably because it does an exec on the last command, as
an optimization):

xvii% zsh -c 'echo foo; bash -c "trap \"echo Interrupt; exit 0\" INT; sleep 5"'; echo OK
foo
^CInterrupt
OK
xvii% echo $?
0

xvii% zsh -c 'echo foo; bash -c "trap \"echo Interrupt; exit 0\" INT; sleep 5"; echo bar'; echo OK
foo
^CInterrupt

xvii% echo $?
130

zsh should implement WCE:

  http://www.cons.org/cracauer/sigint.html

Note that zsh behaves correctly on SIGQUIT.

But for SIGINT, there is worse:

xvii% stty
speed 38400 baud; line = 0;
flush = <undef>;
-brkint -imaxbel iutf8
xvii% zsh -c 'emacs24 & emacs24 -nw; wait'
[Ctrl-G in the terminal]
xvii% stty
speed 38400 baud; line = 0;
                           intr = ^G; quit = ^G; start = <undef>; stop = <undef>; susp = <undef>;
                 rprnt = <undef>; werase = <undef>; lnext = <undef>; flush = <undef>;
     ignbrk -brkint -icrnl -imaxbel iutf8
                                         -onlcr
                                               -iexten
                                                      %
xvii% reset
Interrupt is control-G (^G).

with many display problems (corrupt terminal, cursor positionning...)
because the "emacs24 -nw" process is still running in background.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages zsh depends on:
ii  libc6      2.13-35
ii  libcap2    1:2.22-1.1
ii  libtinfo5  5.9-10

Versions of packages zsh recommends:
ii  libc6         2.13-35
ii  libncursesw5  5.9-10
ii  libpcre3      1:8.30-5

Versions of packages zsh suggests:
ii  zsh-doc  4.3.17-1

-- no debconf information



More information about the Pkg-zsh-devel mailing list