From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20668 invoked by alias); 30 Jun 2017 21:23:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41384 Received: (qmail 9924 invoked from network); 30 Jun 2017 21:23:24 -0000 X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-1.server.virginmedia.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(80.0.253.65):SA:0(0.0/5.0):. Processed in 2.209394 secs); 30 Jun 2017 21:23:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _smtprelay.virginmedia.com designates 80.0.253.65 as permitted sender) X-Originating-IP: [86.21.219.59] X-Authenticated-User: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.1 cv=NqQsCJpJ c=1 sm=1 tr=0 a=utowdAHh8RITBM/6U1BPxA==:117 a=utowdAHh8RITBM/6U1BPxA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=x7bEGLp0ZPQA:10 a=hD80L64hAAAA:8 a=q2GGsy2AAAAA:8 a=2eNmu2F8V_0bxdazr3MA:9 a=CjuIK1q_8ugA:10 a=z9dJwno5l634igLiVhy-:22 Date: Fri, 30 Jun 2017 22:16:10 +0100 From: Peter Stephenson To: zsh workers Subject: Re: interrupt handling bug (again?) Message-ID: <20170630221610.442726ab@ntlworld.com> In-Reply-To: <20170630143347.7f1c252c@pwslap01u.europe.root.pri> References: <170624120310.ZM30935@torch.brasslantern.com> <20170630143347.7f1c252c@pwslap01u.europe.root.pri> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1498857371; bh=2DMN7NVFMvpsOsbQduwyarW30/GUWF/IxPYlI/j0KQs=; h=Date:From:To:Subject:In-Reply-To:References; b=nPyVG5NJyUlVKmGwZh2U+xS107DU5KbOsks+Ny6MTU/s3mfVCu0rs/Xz5XnlMQWkB y1LkZyg/0BCVMTMU8zGC3qr26QfXH7zog3GO2vUlI4OwD1V1aobXdadH9mS+A/966w 0pSHD4I1oICKFfXD+d5SZRh0iyWgrphzGT2sO68Fu+sBlT4NCRAD0yFKZlOm5O8zoD KfmAb65f0ixN5ij22uTv4JsSOvWG/ePqDxocXa3adi96jR5ZeBqLr6SNGEanHewMs4 RUpPcuheYIPIiqw61kFVOlJZ7/YpH7UvJbnIjGsMP8dL3pivigBemBj4W5GxuIF4EZ 3EkqcSHp5kmUQ== On Fri, 30 Jun 2017 14:33:47 +0100 Peter Stephenson wrote: > On Sat, 24 Jun 2017 12:03:10 -0700 > Bart Schaefer wrote: > > > On Jun 6, 9:08pm, Mikael Magnusson wrote: > > } > > } % for a in 1 2 3; do xterm; done > > } then hit ctrl-z in that term and bg it, do stuff and at some point hit > > } ctrl-c, the backgrounded for loop will be interrupted > > ...if you interrupt before the foreground job is done, the > > parent faithfully propagates the signal to the entry in the job > > table, and that kills the loop when it finally does restart. > > I think that is happening, but I'm not sure where. It's check_cursh_sig(SIGINT) from the interrupt handler. It propagates to jobs marked as STAT_CURSH. I think when the SUPERJOB is put into the background it should no longer have STAT_CURSH status. Does that sound reasonable? I'm not sure why it would have it anyway, should it perhaps be removed when we mark it as STAT_SUPERJOB, which is kind of decurrentshellising it in any case? Anyway, this minimal fix seems to do the right thing for the case in question. It might have side effects, though. More specificaly, if it didn't have side effects that would be some kind of record. pws diff --git a/Src/jobs.c b/Src/jobs.c index d1b98ac..09a8bab 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -2303,6 +2303,7 @@ bin_fg(char *name, char **argv, Options ops, int func) } pn = next; } + jobtab[job].stat &= ~STAT_CURSH; } } else if (func == BIN_BG) { /* Silly to bg a job already running. */