From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21741 invoked by alias); 26 Sep 2016 03:13:24 -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: 39440 Received: (qmail 22383 invoked from network); 26 Sep 2016 03:13:24 -0000 X-Qmail-Scanner-Diagnostics: from mail-pf0-f176.google.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(209.85.192.176):SA:0(0.0/5.0):. Processed in 0.710402 secs); 26 Sep 2016 03:13:24 -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=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=rctyjtNNe6r4rB57ExRmUYrh5nPxObvOcPV96YpJPAo=; b=oVYL4gNAAVdaKaHMV/ttQJ7pv7CGcNj1fKGTZEulTGdqJg96SdF36aBAo2rHg6o5YP SfwDMSasKIY2VA1c/8Kts35H0xoPPtc23V1bDmsLIIPMs/OaIoDGXj3e8lPj1x4UihzQ r8HgayNHpAI5IRIeMQS+NjM1fZxJzpO6VWq0n6zlZpHC/ZPKt5VuouNV3kdHd6Ho4bCF LDzr1p51BFtUVzDrfjI1YZSkdNnflbuvBVQijqCU9MbHKyAxnRHsqwyURhTMmuLwPOHV Xgj7VyRTDVh0M8zhZ+0S6jQunt6iVD9omp7GqMF+qA/FKsoMO4jtdk6LBDu7uTyC0T7Y fG5A== 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:in-reply-to:comments :references:to:subject:mime-version; bh=rctyjtNNe6r4rB57ExRmUYrh5nPxObvOcPV96YpJPAo=; b=UVOCZ12TrS84YUqxL6gaMd8dWYrZaPJXN7ikzrU4HywqoRPQyG7ynjzpuFYjMaYu2J 9ZrRS57PNe3QdaFY6HdLhDi2bOHIbwNptC2hL6WJJgBDL+zOjyrYhdymI1potbXWGuYR bpvQq/tL8moM9gFbnFwZmLSm6kukhro2ZX4vdu6UYFauxI4L0Hfn3kdlGsTSdfkqUepv sFsH2GnvMpBcuCp/3Sta655m03xyn6lxod23eyWdGagve+/XRPHac9QSBUhHD/1u5lSG fRfaNNV+RfKNSHPwtRn9v5uKbLA9hVe3PotwtdXim6ccOButp/l42osdqLyPEgMZ/bnm gYjQ== X-Gm-Message-State: AE9vXwOq8xvirJ2sg8EGFWggIWkclClP65nbPv5pWK+yvQ9BACgM4EBwj1QfEqyYjb37RA== X-Received: by 10.98.213.68 with SMTP id d65mr34154208pfg.112.1474859597764; Sun, 25 Sep 2016 20:13:17 -0700 (PDT) From: Bart Schaefer Message-Id: <160925201328.ZM24563@torch.brasslantern.com> Date: Sun, 25 Sep 2016 20:13:28 -0700 In-Reply-To: Comments: In reply to Martijn Dekker "Re: Is "command" working right, yet?" (Sep 26, 12:31am) References: <160202163744.ZM2066@torch.brasslantern.com> <56B761B8.6000507@inlv.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Is "command" working right, yet? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 26, 12:31am, Martijn Dekker wrote: } } The culprit seems to be the simplistic option parsing code starting at } line 2664 in Src/exec.c (current git, e35dcae): } } Sure enough, it looks if there's one option and if there is, it happily } ignores the rest. Combined options like -pV also aren't supported. Not exactly. That whole thing is in a "while" loop, so as long as -p and -v and/or -V are in separate words I think the expectation was that it would loop around and discover the next one .. but if -p is first, it doesn't loop, and if -v or -V is first then -p is rejected because it's not [and can't be, see below] listed in the value of "commandbn" [exec.c 209]. } I don't understand nearly enough about the zsh codebase to know why this } routine does its own option parsing rather than calling some common } option parsing function, so I can't offer suggestions for improvement It's because "command" is a sort-of keyword instead of a builtin, so it doesn't go through the regular builtin dispatch where the common option parsing lives. Originally zsh's "command" prefix didn't accept any options, so this parsing was bolted on bit by bit as POSIX defined them. A complication is that "command -v" is defined in terms of bin_whence(), and "whence" has a -p option that means something different.