zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] 'exec' runs shell functions and builtins
Date: Fri, 4 Aug 2017 16:34:16 +0100	[thread overview]
Message-ID: <20170804153416.GB10499@chaz.gmail.com> (raw)
In-Reply-To: <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


  reply	other threads:[~2017-08-04 15:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170725221050epcas4p131de822f47289e279c7de12de0d6c127@epcas4p1.samsung.com>
2017-07-25 21:49 ` Martijn Dekker
2017-07-26  9:23   ` Peter Stephenson
2017-07-26  9:27     ` Peter Stephenson
2017-07-26 12:53   ` Peter Stephenson
2017-08-04 15:34     ` Stephane Chazelas [this message]
2017-07-26 17:46   ` Bart Schaefer
2017-07-26 17:48     ` Bart Schaefer
2017-07-27  9:02     ` Peter Stephenson
2017-07-28 17:58       ` Bart Schaefer
2017-08-11 15:10         ` Kamil Dudka
2017-08-11 15:25           ` Peter Stephenson
2017-08-14  7:19             ` Kamil Dudka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170804153416.GB10499@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).