From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: vcs_info: '%' in payloads not escaped
Date: Tue, 27 Dec 2016 15:13:54 +0000 [thread overview]
Message-ID: <20161227151354.GA20288@fujitsu.shahaf.local2> (raw)
In-Reply-To: <20161227150507.GA20351@fujitsu.shahaf.local2>
Daniel Shahaf wrote on Tue, Dec 27, 2016 at 15:05:07 +0000:
> I work around this hook by doing ${1//'%'/%%} in my gen-applied-string
> hook. I assume vcs_info itself should be doing that, but I'm not sure
> where in the code to add that. Is the following correct?
>
> [[[
> diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
> index 4ec87c6..6272f69 100644
> --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
> +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
> @@ -149,7 +149,7 @@ VCS_INFO_git_handle_patches () {
> hook_com=( applied "${git_applied_s}" unapplied "${git_patches_unapplied}"
> applied-n ${#git_patches_applied} unapplied-n ${#git_patches_unapplied} all-n ${git_all} )
> if VCS_INFO_hook 'set-patch-format' "${gitmsg}"; then
> - zformat -f gitmisc "${gitmsg}" "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \
> + zformat -f gitmisc "${gitmsg}" "p:${hook_com[applied]//'%'/%%}" "u:${hook_com[unapplied]//'%'/%%}" \
> "n:${#git_patches_applied}" "c:${#git_patches_unapplied}" "a:${git_all}"
So this breaks hooks that intentionally inject coloring sequences:
+vi-git-applied-string() {
hook_com[applied-string]="%F{yellow}$1%f"
ret=1
}
I suppose we could %-escape the patch subject before we call
applied-string, but then applied-string hooks that run «echo $1»
will suddenly get doubled percent signs in there.
Or maybe that's not a supported use of applied-string.
Not sure how to proceed.
Cheers,
Daniel
next prev parent reply other threads:[~2016-12-27 15:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-27 15:05 Daniel Shahaf
2016-12-27 15:13 ` Daniel Shahaf [this message]
2017-01-05 16:07 ` Daniel Shahaf
2017-01-05 16:27 ` Frank Terbeck
2017-01-06 2:21 ` Daniel Shahaf
2017-01-06 10:41 ` Frank Terbeck
2017-01-06 16:40 ` Daniel Shahaf
2017-01-06 17:27 ` Bart Schaefer
2017-01-23 11:04 ` Daniel Shahaf
2017-01-23 18:54 ` Frank Terbeck
2017-02-05 8:28 ` [PATCH] vcs_info: Escape '%' signs in payloads Daniel Shahaf
2017-02-07 8:57 ` Daniel Shahaf
2017-01-06 15:55 ` vcs_info: '%' in payloads not escaped Bart Schaefer
2017-01-06 16:49 ` Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161227151354.GA20288@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).