From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25609 invoked by alias); 13 Oct 2010 01:57:14 -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: 28346 Received: (qmail 29568 invoked from network); 13 Oct 2010 01:57:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <101012185649.ZM20220@torch.brasslantern.com> Date: Tue, 12 Oct 2010 18:56:49 -0700 In-reply-to: <20101012215339.26037042@pws-pc> Comments: In reply to Peter Stephenson "Re: print -D and ${(D)} quoting" (Oct 12, 9:53pm) References: <4637.1286902367@csr.com> <20101012215339.26037042@pws-pc> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: print -D and ${(D)} quoting MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Oct 12, 9:53pm, Peter Stephenson wrote: } } Here, I think, is the uncontroversial part, that changes the (D) } substitution flag. Naturally, asserting lack of controversy means I have a question ... } Index: Doc/Zsh/expn.yo } =================================================================== } item(tt(D))( } Assume the string or array elements contain directories and attempt } +to substitute the leading part of these by names. The remainder of } +the path (the whole of it if the leading part was not subsituted) } +is then quoted so that the whole string can be used as a shell } +argument. This is the reverse of `tt(~)' substitution: see } ifnzman(noderef(Filename Expansion))\ } ifzman(the section FILENAME EXPANSION below). } ) Is quoting the rest of the string really the correct thing to do? Consider ${${(D)foo}:r} or ${=${(D)foo}}. Why do you believe ${(Q)$(D)foo}} should be necessary to operate on the original string, modulo tilde contraction? Is it because that's easier on a zsh script programmer than figuring out where to use (q)? Perhaps steps 13 and 14 from the "rules" should be combined in some way, so (qD) together differs from either used alone? Non-sequitur: The implementation of the (q-) flag is still a bit confusing; the form (q-q) behaves like (qq), but (qq-) is "error in flags" whereas (q-qq), (q-qqq), etc. for any number of "q" after the "-", reports: Src/utils.c:4685: BUG: bad quote type in quotestring and then behaves like (qq).