From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1235 invoked by alias); 27 Jul 2017 09:12:27 -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: 41470 Received: (qmail 2891 invoked from network); 27 Jul 2017 09:12:27 -0000 X-Qmail-Scanner-Diagnostics: from mailout4.w1.samsung.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(210.118.77.14):SA:0(-5.0/5.0):. Processed in 1.501055 secs); 27 Jul 2017 09:12:27 -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=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.samsung.com designates 210.118.77.14 as permitted sender) X-AuditID: cbfec7f2-f797e6d000004438-44-5979ac162ed7 Date: Thu, 27 Jul 2017 10:02:06 +0100 From: Peter Stephenson To: Bart Schaefer , Zsh hackers list Subject: Re: [BUG] 'exec' runs shell functions and builtins Message-id: <20170727100206.4dda10d9@pwslap01u.europe.root.pri> In-reply-to: Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOIsWRmVeSWpSXmKPExsWy7djPc7piayojDWbd17LYP/0hi8XB5odM Dkwe91dNYfVYdf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08AkceD7JqjMOUaJVX29UM5ZRompLdfYQfpZBFQlFmx7 ywpiswkYSkzdNJsRxBYRCJf4M+cZC4gtLGAtMWH3a7B6XgF7ie+988DinALBEhOn34Maeo1R 4sHRrcwgCX4BfYmrfz8xQRxoLzHzyhlGiGZBiR+T74E1MwtoSWze1sQKYctLbF7zFqxXSEBd 4sbd3ewTGIVnIWmZhaRlFpKWBYzMqxhFUkuLc9Nzi430ihNzi0vz0vWS83M3MQJja9uxn1t2 MHa9Cz7EKMDBqMTDGzCpIlKINbGsuDL3EKMEB7OSCO/yFZWRQrwpiZVVqUX58UWlOanFhxhN gSEzkVlKNDkfGPd5JfGGJobmloZGxhYW5kZGSuK8Uz9cCRcSSE8sSc1OTS1ILYLpY+LglGpg 3Nj6ZO6zUpPDpc4KwU2nS3882Vz1pUZUe+PkNVucDuTcU4wRNRNbK3iIX/loyY5zbpdW3uWT P37zblJppwt77UXdnDkM4fOeJc9f9/I22yr1Sy33GaMKXfT+RvnWe4RyOv9f+DXL7kVcxV/l balF0h51e2VSGuV6Hq976f4o7GzPhSut9WlVSizFGYmGWsxFxYkA0jVHfcMCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170727090214eucas1p274aed6f2d95723b7805e93566668ac57 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?UGV0ZXIgU3RlcGhlbnNvbhtTQ1NDLURhdGEgUGxhbmUb?= =?UTF-8?B?7IK87ISx7KCE7J6QG1ByaW5jaXBhbCBFbmdpbmVlciwgU29mdHdhcmU=?= X-Global-Sender: =?UTF-8?B?UGV0ZXIgU3RlcGhlbnNvbhtTQ1NDLURhdGEgUGxhbmUbU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtQcmluY2lwYWwgRW5naW5lZXIsIFNvZnR3YXJl?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDA1Q0QwNTAwNTg=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170726174645epcas4p4a4e5eb03651c6e4e3509c19c1408e0e6 X-RootMTR: 20170726174645epcas4p4a4e5eb03651c6e4e3509c19c1408e0e6 References: On Wed, 26 Jul 2017 10:46:06 -0700 Bart Schaefer wrote: > 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 isn't what I get: % (setopt posixbuiltins; exec command echo foo) zsh: command not found: command % cat ~/bin/builtin #!/bin/sh echo External command named $0 % (setopt posixbuiltins; exec builtin echo) External command named /export/home/pws/bin/builtin There's no further processing of the arguments when we find an exec with posixbuiltins set, so the above is what I'd expect. pws diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 99b1dd4..0e8580d 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -679,7 +679,10 @@ See ifzman(the section `Precommand Modifiers' in zmanref(zshmisc))\ ifnzman(noderef(Precommand Modifiers)). If the option tt(POSIX_BUILTINS) is set, var(command) is never -interpreted as a shell builtin command or shell function. +interpreted as a shell builtin command or shell function. This +means further precommand modifiers such as tt(builtin) and +tt(noglob) are also not interpreted within the shell. Hence +var(command) is always found by searching the command path. cindex(redirection, current shell's I/O) If var(command) is omitted but any redirections are specified,