From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29485 invoked by alias); 4 Aug 2017 15:34:23 -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: 41490 Received: (qmail 25118 invoked by uid 1010); 4 Aug 2017 15:34:23 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f47.google.com 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(74.125.82.47):SA:0(0.5/5.0):. Processed in 1.028276 secs); 04 Aug 2017 15:34:23 -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.5 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM, SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zQvwRdBZIE94jEb4BVUaD2/dlyZ6FweUFSrXhz7m4Lk=; b=SRM5gplqI2BtAcl0dEW0yxURqZvnXjKLpthMbffkwqe4nOWXFwWD4iCpLABGZgkeA0 RlQsd+ytHn8QhQcL2rbsBoV/SBWSxnxuru4iF1gx63F8oMYkC/VfYoPyUu9MwIzyol49 37kp04sEuG6N5h3dEVHlSEPlCZysucIXejUB8Wo2LMRK1C/slDvUyQuiusXYHj4j1L4v EE1esqpW8V0+Tgmx3bOINmCMOnikIQtXTvHEGz2Hms7oh94AxgheHaJSqX322cHmX7rz CURPV2D4ZPfERyzKJuhkPaJlnpA5NuDZMzJwioCwM65RpRDSGb9f9s6gmDOPOgC9fd6c /3eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=zQvwRdBZIE94jEb4BVUaD2/dlyZ6FweUFSrXhz7m4Lk=; b=jIy1WbuVCcmHMuk3IWhx7ob00WiTdfMui1X9298B9DWopbeOPtrBpb8A+f6X/s3nl/ ksno7PxMEAJlfe25WXadmgpQ/T651KKsEIpIq/KLxAKBxvapIY2Ga5/NeGAnayyxW26h MttQrhnreAUb9WzxsvS0M3v71oOQrURFXP0F0a84dEiGjeCwCMTCLc0ZxsOeP+z8FEJB DonPEv8oWpoIoGdNpON0aUIVv3kkIPYclNYGbrZTiZof/MeZjN3qmlCqDRTdYFbH9k8u cleijgv3ZVWYiPpNA3zZUn8NArLSFr5iJgU3tREKZ0C0ouEnXSxLI3htdvNvET3F7zxC mT2A== X-Gm-Message-State: AHYfb5iCcNh0FoKFZ+D6K7toe5nuNLi1R7VhG2OtO7nyyqnsRrhrocv+ 5vAjgJEvyfwD8g== X-Received: by 10.28.87.6 with SMTP id l6mr1550335wmb.110.1501860856757; Fri, 04 Aug 2017 08:34:16 -0700 (PDT) Date: Fri, 4 Aug 2017 16:34:16 +0100 From: Stephane Chazelas To: Peter Stephenson Cc: Zsh hackers list Subject: Re: [BUG] 'exec' runs shell functions and builtins Message-ID: <20170804153416.GB10499@chaz.gmail.com> Mail-Followup-To: Peter Stephenson , Zsh hackers list References: <20170726135338.07aa2ae8@pwslap01u.europe.root.pri> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170726135338.07aa2ae8@pwslap01u.europe.root.pri> User-Agent: Mutt/1.5.24 (2015-08-30) 2017-07-26 13:53:38 +0100, Peter Stephenson: > This clarifies the normal behaviour. > > diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo > index 333db1c..cbaf67a 100644 > --- a/Doc/Zsh/builtins.yo > +++ b/Doc/Zsh/builtins.yo > @@ -675,6 +675,10 @@ executed. > See ifzman(the section `Precommand Modifiers' in zmanref(zshmisc))\ > ifnzman(noderef(Precommand Modifiers)). > > +If the option tt(POSIX_BUILTINS) is not set, var(command) may be > +interpreted as a shell builtin command or shell function: this is run as > +normal (as if tt(exec) were not present), then the shell exits. > + [...] (you jumped the gun a bit there. The issue is only being discussed on the austin-group mailing list. The standard is currently unclear on the matter, it might very well change to allow the zsh/pdksh behaviour. Then again, though the zsh behaviour makes more sense to me, in sh emulation, what matters more is compatibility and it seems more of the widely used sh implementations got with the ksh88 way). It might be worth adding that after exec a_builtin or exec a_function the EXIT, DEBUG or ERR traps will not be executed, as the text above would suggest they may. Other traps and asynchronous job notifications are still handled though (as opposed to when one execs an external command). Not sure it's worth saying what would (not) happen in ! exec something or time exec something -- Stephane