Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] 'exec' runs shell functions and builtins
- X-seq: zsh-workers 41468
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Martijn Dekker <martijn@xxxxxxxx>
- Subject: Re: [BUG] 'exec' runs shell functions and builtins
- Date: Wed, 26 Jul 2017 10:46:06 -0700
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JOptB3g0Ytb4i+m9UvJtUAu3WKWfOOnvOHQsTJMWNSI=; b=JqV955JQDg6o0LUSv+lPnoyKO1LYpMAooFiyunSAgKXa1ewZfIbA8ArjDmJnLcuNup DFuBwn0znLE0N5anjVlx4fgk417xlKXzz+GT3qAERXiChxDoqF/0oLGnGp5giFN/48SY tOhJqs5Pf038a12CGByFn+MfvpvYAl2O9EDl85I3/Lg0ykCj4wfjtpXFICrh6jFLSp/Q Phl35rkQgmfnAmXEyfDstqFOBFY8yeTEpq0zzCAM0bGwNCPFNd9r3wZknTznhctYTQS3 T4cpy4RP0Am9/RXYY3rAvi5UEvxz9h04MT4+TMJHpnFdst8DD2bNA5bTcWQ+zPB1iNsf Dt4A==
- In-reply-to: <fd2a215e-5832-f135-c69d-a1f4e1a6c99e@inlv.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <fd2a215e-5832-f135-c69d-a1f4e1a6c99e@inlv.org>
AFAIK zsh has always had this behavior. It also allows for example
"exec builtin echo" as well as "builtin exec echo" etc. What would
POSIX say that
exec command echo foo
should do? It's relatively easy to stop "exec" from finding functions
and builtin commands, but I think fairly painful to get it to ignore
other "precommand modifier" tokens. Even after PWS's 41464 the above
example runs /bin/echo whereas I think the POSIX expectation would be
to report "command: command not found".
> This behaviour also appears to be contrary to the documentation in
> zshbuiltins(1) ("Replace the current shell with an external command
> rather than forking").
The documentation under "precommand modifiers" (which is
cross-referenced from zshbuiltins) says:
The following command together with any arguments is run in place
of the current process, rather than as a sub-process. The shell
does not fork and is replaced.
I think this is a case of the zshbuiltins doc being ancient and
imprecise rather than intentionally indicative of anything, but:
Messages sorted by:
Reverse Date,
Date,
Thread,
Author