From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29148 invoked by alias); 8 Dec 2014 11:18:16 -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: 33929 Received: (qmail 19685 invoked from network); 8 Dec 2014 11:18:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7fc86d0000066b7-f5-548588f2bbdf Date: Mon, 08 Dec 2014 11:18:06 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: Re: Interrupting globs (Re: Something rotten in tar completion) Message-id: <20141208111806.5cd1ced5@pwslap01u.europe.root.pri> In-reply-to: <20141207171920.0913aae9@pws-pc.ntlworld.com> References: <20141202155452.647182b4@pwslap01u.europe.root.pri> <141202084858.ZM31517@torch.brasslantern.com> <20141202172654.30e7d380@pwslap01u.europe.root.pri> <141204085606.ZM9146@torch.brasslantern.com> <20141204171226.301e9d2c@pwslap01u.europe.root.pri> <141205002023.ZM19736@torch.brasslantern.com> <20141205145054.655a2f70@pwslap01u.europe.root.pri> <141205100632.ZM508@torch.brasslantern.com> <20141205181330.2b458b46@pwslap01u.europe.root.pri> <20141205203417.2bc66b7b@pws-pc.ntlworld.com> <20141205220717.2f86bdd2@pws-pc.ntlworld.com> <141206211828.ZM15934@torch.brasslantern.com> <20141207170713.1a71fe0d@pws-pc.ntlworld.com> <20141207171920.0913aae9@pws-pc.ntlworld.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsVy+t/xy7qfO1pDDHqtLQ42P2RyYPRYdfAD UwBjlJtNRmpiSmqRQmpecn5KZl66rVJoiJuuhZJCXmJuqq1ShK5vSJCSQlliTimQZ2SABhyc A9yDlfTtEtwyLu57z1RwXaRiV6tMA+M8/i5GTg4JAROJrqk7WCFsMYkL99azdTFycQgJLGWU uPj7IwuEs4RJ4uLBKYwgVUIC2xgl/r4qAbFZBFQl/m/YxwJiswkYSkzdNBuohoNDREBbov2j GEhYWMBD4sCWP2AlvAL2EpeXzGcHsTkFrCR2r7zLDjH/CKvE9xff2UAS/AL6Elf/fmKCuMhe YuaVM4wQzYISPybfAxvELKAlsXlbEyuELS+xec1bZojb1CVu3N3NPoFRaBaSlllIWmYhaVnA yLyKUTS1NLmgOCk910ivODG3uDQvXS85P3cTIyRSvu5gXHrM6hCjAAejEg/vhvLmECHWxLLi ytxDjBIczEoivIlxrSFCvCmJlVWpRfnxRaU5qcWHGJOBITORWUo0OR8YxXkl8YYmhuaWhkbG FhbmRkakCSuJ81Z+bQkREkhPLEnNTk0tSC2C2cLEwSnVwFgtmCL0Z/3Kr68v7C16a7qRzVOz RZ29iynYsfHcmr+5sWrn4/SMshbOW/p9QVP11P1ssWv7BT5H9z346R0/48VsSe0TE778k/1t Vl/gra996JLCt/jCs4fn9F4OLo08e2HSW+4cZrtHSd8nB6zhfKp1au/pRzFx81Lcb2/4bnru Jets2c2B7f+VWIozEg21mIuKEwFSIG8A2AIAAA== X-MTR: 20000000000000000@CPGS On Sun, 7 Dec 2014 17:19:20 +0000 Peter Stephenson wrote: > diff --git a/Src/jobs.c b/Src/jobs.c > index 6e47e5e..3c2a21a 100644 > --- a/Src/jobs.c > +++ b/Src/jobs.c > @@ -1444,7 +1444,19 @@ zwaitjob(int job, int wait_cmd) > restore_queue_signals(q); > return 128 + last_signal; > } > - errflag &= ~ERRFLAG_ERROR; > + /* Commenting this out makes ^C-ing a job started by a function > + stop the whole function again. But I guess it will stop > + something else from working properly, we have to find out > + what this might be. --oberon > + > + When attempting to separate errors and interrupts, we > + assumed because of the previous comment it would be OK > + to remove ERRFLAG_ERROR and leave ERRFLAG_INT set, since > + that's the one related to ^C. But that doesn't work. > + There's something more here we don't understand. --pws > + > + errflag = 0; */ > + > if (subsh) { > killjb(jn, SIGCONT); > jn->stat &= ~STAT_STOPPED; Aha! Spotted when trying out TRY_BLOCK_INTERRUPT. I only switched ERRFLAG_ERROR to ERRFLAG_INT when the shell *itself* gets the interrupt. The case here, and in the test I was running, is where we propagate a SIGINT detected by WTERMSIGing (er, that's a verb, right?) a process that exited because it received the ^C (and the shell wasn't part of the foreground process group). The following patch (applicable to the interrupt_abort branch) makes TRY_BLOCK_INTERRUPT do sensible things in that case. Needless to say I haven't dared back off the patch quoted above again... By the way, the cases below already handle SIGINT and SIGQUIT in parallel, which suggest the code I added to do this for mimicking signals on return from a trap is at least consistent. diff --git a/Src/jobs.c b/Src/jobs.c index 3c2a21a..a668b07 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -509,7 +509,7 @@ update_job(Job jn) prev_errflag = errflag; } breaks = loops; - errflag |= ERRFLAG_ERROR; + errflag |= ERRFLAG_INT; inerrflush(); } } else { @@ -526,7 +526,7 @@ update_job(Job jn) prev_errflag = errflag; } breaks = loops; - errflag |= ERRFLAG_ERROR; + errflag |= ERRFLAG_INT; inerrflush(); } if (somestopped && jn->stat & STAT_SUPERJOB) @@ -581,7 +581,7 @@ update_job(Job jn) breaks = loops; } else { breaks = loops; - errflag |= ERRFLAG_ERROR; + errflag |= ERRFLAG_INT; } check_cursh_sig(sig); } pws