From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26348 invoked by alias); 8 Dec 2014 13:03:41 -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: 33931 Received: (qmail 2900 invoked from network); 8 Dec 2014 13:03:40 -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: cbfec7f4-b7f126d000001e9a-45-5485a1a75336 Date: Mon, 08 Dec 2014 13:03:34 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: Re: Interrupting globs (Re: Something rotten in tar completion) Message-id: <20141208130334.4ea54996@pwslap01u.europe.root.pri> In-reply-to: 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> <20141208111806.5cd1ced5@pwslap01u.europe.root.pri> 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+NgFlrPIsWRmVeSWpSXmKPExsVy+t/xy7rLF7aGGMy8YWFxsPkhkwOjx6qD H5gCGKPcbDJSE1NSixRS85LzUzLz0m2VQkPcdC2UFPISc1NtlSJ0fUOClBTKEnNKgTwjAzTg 4BzgHqykb5fglnF9zgO2gvu8FS92PmRtYDzO1cXIySEhYCLxcMdzFghbTOLCvfVsXYxcHEIC Sxkl1s2ezwjhLGeSmP/nCStIFYuAqsTEd3fBOtgEDCWmbpoNVMTBISKgLdH+UQwkLCzgIXFg yx+wEl4Be4m+aXfAWjkFgiVa53+EmnmQTeLNslZGkAS/gL7E1b+fmCCusJeYeeUMI0SzoMSP yffABjELaEls3tbECmHLS2xe85Z5AqPALCRls5CUzUJStoCReRWjaGppckFxUnquoV5xYm5x aV66XnJ+7iZGSPB/2cG4+JjVIUYBDkYlHl5zxdYQIdbEsuLK3EOMEhzMSiK8iXFAId6UxMqq 1KL8+KLSnNTiQ4zJwNCYyCwlmpwPjMy8knhDE0NzS0MjYwsLcyMj0oSVxHkrvraECAmkJ5ak ZqemFqQWwWxh4uCUamAs+lHGqHhr8bLQgx+CPkck7NcImuTV/u690d099cu7Vl9Tv/4nXu7/ ih1/RRUyhJOLWh2Olh+vuhLO90D71Oypb/rmLzUt72dKVtqyrVtngrLvFpsA6bjF7nzGcRZz d+jOkgnK68iN/O4X8Oc4f/Tby9FR1VXxfsumXenY/v7uxxnGei7+/xuVWIozEg21mIuKEwHx w+vvwgIAAA== X-MTR: 20000000000000000@CPGS On Mon, 8 Dec 2014 13:43:11 +0100 Mikael Magnusson wrote: > Test case for you guys: > % zsh -f > % precmd() echo yes > % sleep 2; echo no > ^C > yes I will assume it's uncontroversial that we do want the yes and not the no. It looks reasonable. (As an entirely separate matter, I wonder if precmd should have the error status available to it?) > With :/'Ensure propagation' and :/'Put back' (eg, current tip of > interrupt_abort), I get neither printed. > > So I guess some other place needs to clear interrupts as well, or the > "return to commandline" clear should be before precmd being called? > (If that's nonsense it's because I haven't looked at the code for that > at all). I think we should clear it before and after precmd to be safe. It's not really clear to me why this worked before; one of the various other errflag-clearings must have come in before we reached the top-level loop. I'm not sure if that was intentional or accidental, but presumably somewhere high up in loop() with toplevel == 1 is right. I can't work out if it should be even higher, before the history mechanism starts. pws diff --git a/Src/init.c b/Src/init.c index 3cbd4e5..3059087 100644 --- a/Src/init.c +++ b/Src/init.c @@ -118,6 +118,14 @@ loop(int toplevel, int justonce) if (interact && toplevel) { int hstop = stophist; stophist = 3; + /* + * Reset all errors including the interrupt error status + * immediately, so preprompt runs regardless of what + * just happened. We'll reset again below as a + * precaution to ensure we get back to the command line + * no matter what. + */ + errflag = 0; preprompt(); if (stophist != 3) hbegin(1);