From 07b829c894738e4ad594dc5f8d73401fbd83f203 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 21 Feb 2022 18:34:28 +0100 Subject: fix(vcs_info): quote % in relevant fields on all current Zsh releases --- lib/vcs_info.zsh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/vcs_info.zsh') diff --git a/lib/vcs_info.zsh b/lib/vcs_info.zsh index 01dcd90b6..edb515ce0 100644 --- a/lib/vcs_info.zsh +++ b/lib/vcs_info.zsh @@ -1,8 +1,11 @@ -# Impacted versions go from v5.0.3 to v5.8 (v5.8.1 is the first patched version) -autoload -Uz is-at-least -if is-at-least 5.8.1 || ! is-at-least 5.0.3; then - return -fi +# Don't skip this file until a Zsh release does the necessary quoting. +# This is because even though 5.8.1 undid recursive prompt_subst inside +# prompt sequences, % characters in relevant fields will still be rendered +# incorrectly in vcs_info, on all Zsh releases up to writing this. +# +# There is no release yet that does this right, since it requires changing +# how what vcs_info hooks expect to receive. Even so, I'd rather be correct +# and break custom vcs_info hooks than have a broken prompt. # Quote necessary $hook_com[] items just before they are used # in the line "VCS_INFO_hook 'post-backend'" of the VCS_INFO_formats -- cgit v1.2.3-70-g09d2 From b00b59364a019894ee4b9ba4062d922fedaa5ccd Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 21 Feb 2022 20:28:40 +0100 Subject: fix(vcs_info): don't patch VCS_INFO_formats if not found --- lib/vcs_info.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/vcs_info.zsh') diff --git a/lib/vcs_info.zsh b/lib/vcs_info.zsh index edb515ce0..e60938c14 100644 --- a/lib/vcs_info.zsh +++ b/lib/vcs_info.zsh @@ -38,7 +38,7 @@ # due to malicious input as a consequence of CVE-2021-45444, which affects # zsh versions from 5.0.3 to 5.8. # -autoload -Uz +X regexp-replace VCS_INFO_formats +autoload -Uz +X regexp-replace VCS_INFO_formats 2>/dev/null || return # We use $tmp here because it's already a local variable in VCS_INFO_formats typeset PATCH='for tmp (base base-name branch misc revision subdir) hook_com[$tmp]="${hook_com[$tmp]//\%/%%}"' -- cgit v1.2.3-70-g09d2