From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17713 invoked from network); 18 Jul 2009 18:16:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 18 Jul 2009 18:16:53 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 52791 invoked from network); 18 Jul 2009 18:16:42 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 Jul 2009 18:16:42 -0000 Received: (qmail 4028 invoked by alias); 18 Jul 2009 18:16:29 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27159 Received: (qmail 4001 invoked from network); 18 Jul 2009 18:16:27 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 18 Jul 2009 18:16:27 -0000 Received: from vms173005pub.verizon.net (vms173005pub.verizon.net [206.46.173.5]) by bifrost.dotsrc.org (Postfix) with ESMTP id DFD52801E289 for ; Sat, 18 Jul 2009 20:16:23 +0200 (CEST) Received: from torch.brasslantern.com ([96.238.220.32]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KMZ00181PF5R9PB@vms173005.mailsrvcs.net> for zsh-workers@sunsite.dk; Sat, 18 Jul 2009 13:16:22 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id n6IIGG8V010395 for ; Sat, 18 Jul 2009 11:16:17 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id n6IIGFTL010394 for zsh-workers@sunsite.dk; Sat, 18 Jul 2009 11:16:15 -0700 From: Bart Schaefer Message-id: <090718111615.ZM10393@torch.brasslantern.com> Date: Sat, 18 Jul 2009 11:16:15 -0700 In-reply-to: <20090718101602.GA5392@xvii> Comments: In reply to Vincent Lefevre "Re: zsh 4.3.10 terminates with SIGINT when one types Ctrl-G in emacs under Mac OS X" (Jul 18, 12:16pm) References: <090712193623.ZM14823@torch.brasslantern.com> <200907131839.n6DIdO6Z003291@pws-pc.ntlworld.com> <20090716162419.GA26179@prunille.vinc17.org> <090717222936.ZM8648@torch.brasslantern.com> <20090718101602.GA5392@xvii> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@sunsite.dk Subject: Re: zsh 4.3.10 terminates with SIGINT when one types Ctrl-G in emacs under Mac OS X MIME-version: 1.0 Content-type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.94.2/9588/Sat Jul 18 07:14:41 2009 on bifrost X-Virus-Status: Clean I'm going to send two replies to this part of the thread for different subsets of Vincent's remarks, so that neither message gets too long. This first one has a bunch of strace output in it. Jump towards the end for the punchline. On Jul 18, 12:16pm, Vincent Lefevre wrote: } Subject: Re: zsh 4.3.10 terminates with SIGINT when one types Ctrl-G in em } } On 2009-07-17 22:29:36 -0700, Bart Schaefer wrote: } > When running a shell script (not interactively), zsh does NO HANDLING } > of SIGINT whatsoever. It's implementing IUE, not WUE. Or to be more } > precise, it's implementing the default behavior on SIGINT, which is } > usually to exit. } } Yes, this is what I can see with zsh 4.3.10 (but zsh 4.2.3 implemented } WUE). Let's look at that a bit more closely. Here's 4.2.6 (slight difference in OS version may account for the missing RT_1 in the sigprocmask): pipe([3, 4]) = 0 gettimeofday({1247938636, 336849}, {480, 0}) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb75e4868) = 27231 close(4) = 0 read(3, "", 1) = 0 close(3) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0 rt_sigsuspend(~[HUP CHLD RTMIN] --- SIGCHLD (Child exited) @ 0 (0) --- <... rt_sigsuspend resumed> ) = -1 EINTR (Interrupted system call) rt_sigprocmask(SIG_BLOCK, ~[RTMIN], ~[HUP KILL STOP RTMIN], 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[HUP KILL STOP RTMIN], ~[KILL STOP RTMIN], 8) = 0 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WUNTRACED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 27231 gettimeofday({1247938666, 347837}, {480, 0}) = 0 wait4(-1, 0xbfffd14c, WNOHANG|WUNTRACED, 0xbfffd154) = -1 ECHILD (No child processes) sigreturn() = ? (mask now [CHLD]) --- SIGINT (Interrupt) @ 0 (0) --- Now here's 4.2.6 with the TRAPS_ASYNC option set: pipe([3, 4]) = 0 gettimeofday({1247939573, 896574}, {480, 0}) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb75e0868) = 27252 close(4) = 0 read(3, "", 1) = 0 close(3) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0 rt_sigsuspend([] --- SIGINT (Interrupt) @ 0 (0) --- And finally 4.3.10-dev-1, doesn't matter whether TRAPS_ASYNC is set: pipe([3, 4]) = 0 gettimeofday({1247938336, 854096}, {420, 0}) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f6c708) = 10263 close(4) = 0 read(3, "", 1) = 0 close(3) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0 rt_sigsuspend([] --- SIGINT (Interrupt) @ 0 (0) --- This was changed in this patch ... * 23067: Doc/Zsh/builtins.yo, Src/jobs.c, Src/signals.c: queue traps but handle signals when waiting for jobs or processes, unless TRAPSASYNC is set or the wait builtin is in use, so as to handle untrapped signals in a timely fashion; document that negative or zero process IDs after kill may be handled specially by the OS. ... when the signal_suspend_setup() function was removed from signals.c because of a problem with interrupting "wait". This began in 23053 as a MacOS bug report and relevant dicussion continues in 23055 and 23061. Apparently you darn Mac users can't make up your mind. :-)