From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27405 invoked by alias); 27 Dec 2016 15:17:00 -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: 40241 Received: (qmail 22603 invoked from network); 27 Dec 2016 15:17:00 -0000 X-Qmail-Scanner-Diagnostics: from out1-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.25):SA:0(-0.7/5.0):. Processed in 0.479092 secs); 27 Dec 2016 15:17:00 -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.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=KXcg41mm6MDrmydxkGeQqDcL6I0=; b=MWit2hBfLAN5VjqPWiOfm BoILb8MDJvenXfAJMsk+5uL1oaMHz5JkhQ23C+gh3s72o1dL8W9XDULReZJ5OAWJ rhHMFtTCTAF7svrgc7p9wup0B8pzWiKtbgtQAGLdiPNpDRLelB8mvfR+mk78APKy d7+oCBdo5tK6zmRMxQr4Og= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=KXcg41mm6MDrmydxkGeQqDcL6I0=; b=rNK3PJUc1kWaggm9sRx5 zXaMUi9z6TxLm0LHM8xtUaU7xkLEGVx5lO7J3MKmQBQDyb4qCwh3KHBsfDxP1Kb1 Lg6bQRMAnqm3h7UnMqRmH4T8YCoa6JxsZBL779f6X4amPyr14vQEA3qKaGjRvIKR D37+BZbjSab0U8f6KcsiUaA= X-ME-Sender: X-Sasl-enc: PysSDtyEvpd56qJoOBP3tJZL/MJNHoNtNzIO8adiJU38 1482851816 Date: Tue, 27 Dec 2016 15:13:54 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: vcs_info: '%' in payloads not escaped Message-ID: <20161227151354.GA20288@fujitsu.shahaf.local2> References: <20161227150507.GA20351@fujitsu.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161227150507.GA20351@fujitsu.shahaf.local2> User-Agent: Mutt/1.5.23 (2014-03-12) 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