From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 958 invoked by alias); 28 Sep 2014 17:11:37 -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: 33262 Received: (qmail 29675 invoked from network); 28 Sep 2014 17:11:35 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; bh=ARxke3+4ZvrnBwaBPUJPQweGE61CaXRvrW7uuPc6r/c=; b=uxtIVNGG4daTUSxAZNQOoJoW64cg9ULkjzQB4L04vFR00ASwwr2UZziAGu8Awl73R/ W3ZU+7sYkKReMS0FRH+CN/2wvI2sEa29I71iCMkv3Xupo5LJ9pC3XP1jsf5DMwwTiB94 iBiQQBgT8ubulLEOO00SkdZsWTktwEm8lujLYEFPfzfBS8oDvINzXmt4y67GKpm/Ysjq VIGSEjHr8EA3wl9MvkyDAg3Wxo9b5XN9Bds3fzx24eYQrWjOrdra8cNJm/wgVc3+/X91 AwGgq+G3k17I3C9dXj9h6s2Qhcs7j0rC1vcBDLr+RrkWlb5Jf8Fdn2Dn2MxYAotJGf5q YgZA== X-Received: by 10.180.73.209 with SMTP id n17mr42334531wiv.34.1411924291568; Sun, 28 Sep 2014 10:11:31 -0700 (PDT) Date: Sun, 28 Sep 2014 19:10:33 +0200 From: Marco Hinz To: zsh-workers@zsh.org Subject: [patch] Fix VCS_INFO_reposub's whitespace handling Message-ID: <20140928171033.GA11234@cheyenne> Mail-Followup-To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8t9RHnE3ZwKMSgU+" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, VCS_INFO_reposub is the function called to process VCS_INFO's %S flag in 'formats' and 'actionformats'. Problem: $ mkdir -p '/tmp/foo bar' $ cd !$ $ VCS_INFO_reposub Output: "tmp/foobar" instead of "tmp/foo bar". I'm new to zsh internals, but apparently something causes the string 'foo bar' to be read in as 2 arguments. printf only takes 1 argument, and so 'bar' just gets appended. Could someone point me to the appropriate parameter expansion rule? Solution: Double-quote ${$(pwd -P)#$base/}. Regards, Marco --8t9RHnE3ZwKMSgU+ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="reposub.patch" diff --git a/Functions/VCS_Info/VCS_INFO_reposub b/Functions/VCS_Info/VCS_INFO_reposub index 1c16f0e..0e6a8b0 100644 --- a/Functions/VCS_Info/VCS_INFO_reposub +++ b/Functions/VCS_Info/VCS_INFO_reposub @@ -9,5 +9,5 @@ local base=${1%%/##} printf '.' return 1 } -printf '%s' ${$(pwd -P)#$base/} +printf '%s' "${$(pwd -P)#$base/}" return 0 --8t9RHnE3ZwKMSgU+--