From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15604 invoked from network); 17 Jul 2009 20:00:47 -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.6 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; 17 Jul 2009 20:00:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 84896 invoked from network); 17 Jul 2009 20:00:34 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Jul 2009 20:00:34 -0000 Received: (qmail 23900 invoked by alias); 17 Jul 2009 20:00:21 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27155 Received: (qmail 23887 invoked from network); 17 Jul 2009 20:00:21 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 17 Jul 2009 20:00:21 -0000 Received: from mtaout01-winn.ispmail.ntl.com (mtaout01-winn.ispmail.ntl.com [81.103.221.47]) by bifrost.dotsrc.org (Postfix) with ESMTP id D9F66801E289 for ; Fri, 17 Jul 2009 22:00:17 +0200 (CEST) Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090717200017.KOTG6742.mtaout01-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com> for ; Fri, 17 Jul 2009 21:00:17 +0100 Received: from pws-pc ([81.107.42.185]) by aamtaout03-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090717200017.GWU2093.aamtaout03-winn.ispmail.ntl.com@pws-pc> for ; Fri, 17 Jul 2009 21:00:17 +0100 Date: Fri, 17 Jul 2009 21:00:09 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: [PATCH]: New hook function "atexec" Message-ID: <20090717210009.1570d7dd@pws-pc> In-Reply-To: <943349.74078.qm@web37304.mail.mud.yahoo.com> References: <943349.74078.qm@web37304.mail.mud.yahoo.com> X-Mailer: Claws Mail 3.7.1 (GTK+ 2.16.2; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.0 c=1 a=uOXXDwQA2VYA:10 a=CjxXgO3LAAAA:8 a=NLZqzBF-AAAA:8 a=ij2tXjxWpxYS25tzXVIA:9 a=_lvQJws-OGWpWD1aocYA:7 a=T3dUT3oKt20_EW-nTLU55rwCY44A:4 a=rC2wZJ5BpNYA:10 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.94.2/9584/Fri Jul 17 20:56:27 2009 on bifrost X-Virus-Status: Clean On Thu, 16 Jul 2009 23:27:49 -0700 (PDT) Michael Hwang wrote: > I've hacked in a new hook function similar to preexec called "atexec". That's a reasonable idea: some thoughts: I'm not sure where this needs to be called execcmd(), there's so much going on there. The issue I'm most worried about is redirection; where is the output of hook functions called in the middle of a pipeline going? However, it also worries me that this is calling execcmd() recursively in strange ways never before attempted---we partly set up a command for execution, then call an entire arbitrary execution tree, then finish executing the command. This could easily have odd effects. I wonder if using execsave() and execrestore() might be sensible. I'm surprised you only need to set atexec to zero in two places, but there may be another way of testing the conditions you want anyway. I don't see why you need the test for sourcelevel, which stops it happening in all "." files. That might be sensible for init files, but otherwise it seems a bit arbitrary when other limitations might be more useful. For example, I don't see anything to stop this being run for every individual command in every function run by the user, which could be a huge overhead, probably more so that "." files which tend to be one-off. (I think the test for "sfcontext" happens to catch a lot of completion functions, however.) I'd be tempted to add a "locallevel" test to exclude all function bodies. If necessary we can think of a way of reactivating it in a function. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/