Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[patch] Fix VCS_INFO_reposub's whitespace handling
- X-seq: zsh-workers 33262
- From: Marco Hinz <mh.codebro@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [patch] Fix VCS_INFO_reposub's whitespace handling
- Date: Sun, 28 Sep 2014 19:10:33 +0200
- 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==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author