From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27517 invoked by alias); 8 Sep 2016 11:02:31 -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: 39236 Received: (qmail 12150 invoked from network); 8 Sep 2016 11:02:31 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.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(66.111.4.28):SA:0(0.0/5.0):. Processed in 1.634687 secs); 08 Sep 2016 11:02:31 -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: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=3SSHZwYcscs0Uih9f2Kb3Zsouis=; b=LIGnx6 EcywUlqL7v+B1w5yZrUF4mAtIFYIJ9RMjjiZoIloDO18WId5r60VGDBynqCiEmUi KomPe3aYuPsfLZ2EzUvuHCBA5C4VQI3zm3qTKfIR/UczTGA6HQU1lh6fFsILn+JA BL3S1PRGnchWCEt1N/8ccR5RkoKMHnvSJuhaQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=3SSHZwYcscs0Uih9f2Kb3Zsouis=; b=BbJpc 6jt/+bnnVLiLkbPFdO35Gs7M5gz2hxPCKB66Ri5t0iFR/QPKShQ58gsfgox1+DT+ ET+2PfVUmdudORbmdMfiaxfGiUNckIH6VDorGBQYEMSSxkr+84y28JhE2Nzfkoxn 43ef/vPiXdK4psgUg68vFV5+MDgSMClb3nveH8= X-Sasl-enc: 2/GnIiiXwRg3+gB2X7A/COOKVg13DsLbHyCp5z4QJ3w4 1473332517 Date: Thu, 8 Sep 2016 11:01:15 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: [PATCH] _arguments: Escape colons and backslashes in $opt_args unambiguously. Message-ID: <20160908110115.GA1707@fujitsu.shahaf.local2> References: <1473013592-24926-1-git-send-email-danielsh@fujitsu.shahaf.local2> <160907000320.ZM11510@torch.brasslantern.com> <20160907220701.GA7775@fujitsu.shahaf.local2> <160907171356.ZM14819@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <160907171356.ZM14819@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) Bart Schaefer wrote on Wed, Sep 07, 2016 at 17:13:56 -0700: > I suspect "ag" is the same thing I have installed as "ack". "ag" and "ack" are distinct tools. Applied both of your suggestions, and added a paragraph: diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index b2cc392..ecf17e7 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -3949,9 +3949,7 @@ arguments. Options are stored in the associative array `tt(opt_args)' with option names as keys and their arguments as the values. For options that have more than one argument these are given as one string, separated by colons. All colons and backslashes -in the original arguments are preceded with backslashes. (Note: -Zsh 5.2 and older did not escape backslashes in the original string; -see the tt(NEWS) file for details.) +in the original arguments are preceded with backslashes. The parameter `tt(context)' is set when returning to the calling function to perform an action of the form `tt(->)var(string)'. It is set to an diff --git a/README b/README index 019294e..d92fb61 100644 --- a/README +++ b/README @@ -91,10 +91,15 @@ equivalent of "*(1)") as well as many other forms. and colons in the values of option arguments when populating the $opt_args associative array. Previously, colons were escaped with a backslash but backslashes were not themselves escaped with a backslash, which lead to -ambiguity: if the -x option took two arguments (as in +ambiguity: '-x foo\:bar' (one argument with a backslashed colon) and +'-x foo\\ bar' (two argumnets, and the first one ends in a backslash) would +both set $opt_args[-x] to the same value. This example assumes the -x +option's spec declared two arguments, as in: _arguments : -x:foo:${action}:bar:$action -), it would be impossible to tell from $opt_args whether the command-line -was '-x foo\:bar' or '-x foo\\ bar'. + +For the more common case of non-repeatable options that take a single +argument, completion functions now have to unescape not only colons but +also backslashes when obtaining the option's argument from $opt_args. Incompatibilities between 5.0.8 and 5.2 ---------------------------------------