Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] 'exec' runs shell functions and builtins
- X-seq: zsh-workers 41490
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: [BUG] 'exec' runs shell functions and builtins
- Date: Fri, 4 Aug 2017 16:34:16 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- 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==
- In-reply-to: <20170726135338.07aa2ae8@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Peter Stephenson <p.stephenson@xxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20170725221050epcas4p131de822f47289e279c7de12de0d6c127@epcas4p1.samsung.com> <fd2a215e-5832-f135-c69d-a1f4e1a6c99e@inlv.org> <20170726135338.07aa2ae8@pwslap01u.europe.root.pri>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author