From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26856 invoked by alias); 3 Feb 2016 00:36:53 -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: 37870 Received: (qmail 5474 invoked from network); 3 Feb 2016 00:36:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version:content-type; bh=bPEbp9TLjpnQE4gBzBY5VUm6MQgmZR3hfOG6mY2IT7w=; b=X/RREz0KLHqr2qV7mDqjNUBMGSn2HLLLcTF/WFUpPAkRkD40d2YQwk/TwCrYIahvpk QJPRKY5CfVSBtOp/h3cbh2WBiqc8vCgj3VOUVYA7VGA03NV62kTB8nFskfVtdVIQeX4x 9BqMG0yJMf8t6mtoklWlkOCC4cU+fCFY0UCzNgn7z3kfW+LXpIcZWbRBg+R+ebIyXqGU Q04goEp7XF2BHUpOOP/+Lr8oJfWc8XqUeEYCpG+GsApEga8Y9eSSpa7TD9YK3CRgfxVS RVk2PNmSfEF2qJiicIHMWQUZphgeartt0Y8pK5ooWyhmPke6Xg7FwHArjRw2grz+R+Gr uKpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:to:subject:mime-version :content-type; bh=bPEbp9TLjpnQE4gBzBY5VUm6MQgmZR3hfOG6mY2IT7w=; b=YE0sA403dOpTiS4lAHIw94XS8Zs7P3Ly3aDOgIGt3ZX6DD7Qg44ztOgpq0ZiShKhA9 0fk+SsA8kzeOooTVYMFbtseL6r0AjQXogwCOjI3lfSeAs55Ae0yro0KSCWNYA7fiUciS YoP3z8Bpg/jmLIPwqBARXnXzWFV56yVOKtNwDIhhlGko0wnCd0BrzUyZGoCYC+3FTrHh xO/BTlZ2G5VvxFwUDqoujrLSFJMdsPejL7fqrRIojFLpJbDxReVndP0Z8yDNyE7+dRhN IohxV05T8PHmNpseux1Qxs/hx4Gv6BwvNAhNrxpjSWPHDuSy/CXPLcLlHdvOmvZL+9ix T4FA== X-Gm-Message-State: AG10YORYfmzOtYEmpvNAeynJqd6yzX2ab0lsiveD0XRFunF7NTh8igszdiVArikmbux0hA== X-Received: by 10.98.18.8 with SMTP id a8mr52068248pfj.41.1454459808636; Tue, 02 Feb 2016 16:36:48 -0800 (PST) From: Bart Schaefer Message-Id: <160202163744.ZM2066@torch.brasslantern.com> Date: Tue, 2 Feb 2016 16:37:44 -0800 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Is "command" working right, yet? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii command [ -pvV ] The command word is taken to be the name of an external command, rather than a shell function or builtin. If the POSIX_BUILTINS option is set, builtins will also be executed but certain special properties of them are suppressed. The -p flag causes a default path to be searched instead of that in $path. With the -v flag, command is similar to whence and with -V, it is equivalent to whence -v. Prelimnaries: I've created my own "true" at the head of $path to be able to distinguish the builtin from the external command. It just echoes EXTERNAL, like so: burner% disable true burner% true EXTERNAL First let's talk about option parsing. burner% command -p -V true zsh: command not found: -V burner% command -V -p true command: bad option: -p burner% command -pv true zsh: command not found: -pv Those options can be combined in both bash and ksh. Setting posixbuiltins makes no difference to zsh: burner% setopt posixbuiltins burner% command -p -V true zsh: command not found: -V burner% command -V -p true command: bad option: -p I think this is pretty clearly a bug. The next question has to do with builtins and path search. There was a long thread about this on the austin-group (POSIX standards) list several weeks ago and I'm still not sure what the final outcome implies. The issue is the circumstances in which builtins are allowed to mask commands in $PATH. Starting over with a fresh "zsh -f" so the builtin is enabled and NO_POSIX_BUILTINS, "command" runs the external but "command -p" runs the builtin: burner% command true EXTERNAL burner% command -p true burner% The latter seems a little odd to me, but I suppose that means that when the doc says "a default path" it means one with builtins implicitly at the front? However, it relates to the last question: Using the versions available on my Ubuntu desktop, and default $PATH, all of bash, ksh, and zsh with POSIX_BUILTINS, execute the builtin for both "command" and "command -p". Anybody know if that's correct? If it is, how does one force the use of the external command in [the forthcoming] POSIX? (If it involves magic syntax in $PATH, I can't assert that zsh is going to adopt it, but I'd still like to know the answer.)