From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13418 invoked from network); 5 Aug 2008 01:33:40 -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 news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Aug 2008 01:33:40 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 1083 invoked from network); 5 Aug 2008 01:33:27 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Aug 2008 01:33:27 -0000 Received: (qmail 12725 invoked by alias); 5 Aug 2008 01:33:22 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25390 Received: (qmail 12707 invoked from network); 5 Aug 2008 01:33:21 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 5 Aug 2008 01:33:21 -0000 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.177]) by bifrost.dotsrc.org (Postfix) with ESMTP id B122480590E6 for ; Tue, 5 Aug 2008 03:33:17 +0200 (CEST) Received: by wa-out-1112.google.com with SMTP id v27so1816443wah.21 for ; Mon, 04 Aug 2008 18:33:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=5jymCOPYEqIzK7DBUnajMJ60vo5bNMTO9E3EVENDXkk=; b=ZOdzZF95dL4y/8tn09b83GYkE7ZbpB3CduEHNGU10TrADr8/CMHzCRqzSCFg86CxOw 2ECUs5qYscQJDi4c4eL1OGWcw5g+9SZC0EQIUlOpjq+mDu04Pnx5Jmoa5TmTwn0gjgGo M9l0Y+DlRXvWe61UvZxxV9q3n+QktPGSNM+Cw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=hMR6aS6v592Co1d3crfUNYkIpEzZyCo7aPFhQ3qyZcEvCm/yR5c07tRuZ1fTh/bdU7 2FnBJSjhnTLYVpdRB8vktGL9T9RRQsasn6j5AC3deySp8OFu35sTDTvxzHww9ZV8Qo3e rYe3h23Tgl6rEFVItYlJdw4hgceekgrCqqVJE= Received: by 10.114.53.1 with SMTP id b1mr15169307waa.53.1217899996173; Mon, 04 Aug 2008 18:33:16 -0700 (PDT) Received: by 10.114.159.2 with HTTP; Mon, 4 Aug 2008 18:33:16 -0700 (PDT) Message-ID: <6cd6de210808041833me334c40ncc65835d8da4b5ba@mail.gmail.com> Date: Mon, 4 Aug 2008 21:33:16 -0400 From: "Rocky Bernstein" To: zsh-workers@sunsite.dk Subject: eval and resetting $? (Was Re: trap DEBUG + set -o DEBUG_BEFORE_CMD not setting $? nonzero in current CVS) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: ClamAV 0.92.1/7941/Tue Aug 5 00:44:27 2008 on bifrost X-Virus-Status: Clean Thanks. This seems to work. However when I use it I run into something else that looks like either a bug or at least something whose behavior should be documented. In the following program it feels like $? gets changed/reset? before eval is run: #!/usr/local/bin/zsh -f cmd='print $?' fdsafsdsfa # Invalid command eval $cmd # print $? works and so does # ./file-containing: print $? print $? works because $? is expanded before print is run. And sourcing a file which contains the string I want to eval also works, so this gives me a workaround for this problem. But somehow I think that a string writing that to a file and sourcing it should be equivalent to eval'ing the string. On Mon, Aug 4, 2008 at 1:49 PM, Peter Stephenson wrote: > On Mon, 4 Aug 2008 06:08:39 -0400 > "Rocky Bernstein" wrote: >> The following code doesn't show $? as nonzero inside trap DEBUG using the >> CVS source I just downloaded and built. >> >> However I don't get this problem on the Ubuntu zsh-beta or zsh. >> Removing DEBUG_BEFORE_CMD (or I guess having debug run after the >> command) does set/show $? properly. >> >> #!/tmp/zsh/Src/zsh -f >> #!/src/external-cvs/zsh/Src/zsh -f >> set -o DEBUG_BEFORE_CMD >> trap 'print $?' DEBUG >> fdasfsdafd # invalid command >> : > > Turns out to be unfinished business with the previous patch: that code I > patched needs also to be told when we're not in a trap at all. It was > triggering after the trap, resetting the status. > > I must write tests for both. > > Index: Src/init.c > =================================================================== > RCS file: /cvsroot/zsh/zsh/Src/init.c,v > retrieving revision 1.89 > diff -u -r1.89 init.c > --- Src/init.c 4 Aug 2008 17:32:20 -0000 1.89 > +++ Src/init.c 4 Aug 2008 17:46:26 -0000 > @@ -191,7 +191,7 @@ > exit(lastval); > if (((!interact || sourcelevel) && errflag) || retflag) > break; > - if (trapreturn >= 0) { > + if (intrap && trapreturn >= 0) { > lastval = trapreturn; > trapreturn = 0; > } > > > -- > Peter Stephenson Software Engineer > CSR PLC, Churchill House, Cambridge Business Park, Cowley Road > Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 >