From 0577dafcaa9d5f7cdbf5637b2dea5ed71dd5af81 Mon Sep 17 00:00:00 2001 From: Stephane Chazelas Date: Fri, 2 Jun 2023 16:09:53 +0100 Subject: Protect some :s from history modifier expansion --- Completion/Unix/Command/_ant | 4 ++-- Completion/Unix/Command/_ant.rej | 13 +++++++++++++ Completion/Unix/Command/_ffmpeg | 2 +- Completion/Unix/Command/_java | 4 ++-- Completion/Unix/Command/_subversion | 4 ++-- Completion/Zsh/Command/_cd | 2 +- 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 Completion/Unix/Command/_ant.rej (limited to 'Completion') diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index 7401c7449..36c7c0e89 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -79,8 +79,8 @@ case $state in compset -P '*:' compset -S ':*' _alternative \ - "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \ - "classpath:$state:_path_files -r': ' -/" && ret=0 + "classpath:${state}:_path_files -qS: -g '*.(jar|zip)(-.)'" \ + "classpath:${state}:_path_files -r': ' -/" && ret=0 ;; property) if compset -P 1 '*='; then diff --git a/Completion/Unix/Command/_ant.rej b/Completion/Unix/Command/_ant.rej new file mode 100644 index 000000000..15e26c9da --- /dev/null +++ b/Completion/Unix/Command/_ant.rej @@ -0,0 +1,13 @@ +--- Completion/Unix/Command/_ant ++++ Completion/Unix/Command/_ant +@@ -79,8 +79,8 @@ case $state in + compset -P '*:' + compset -S ':*' + _alternative \ +- "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \ +- "classpath:$state:_path_files -r': ' -/" && ret=0 ++ "classpath:${state}:_path_files -qS: -g '*.(jar|zip)(-.)'" \ ++ "classpath:${state}:_path_files -r': ' -/" && ret=0 + ;; + property) + if compset -P 1 '*='; then diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg index 1329939cd..e5afdac4f 100644 --- a/Completion/Unix/Command/_ffmpeg +++ b/Completion/Unix/Command/_ffmpeg @@ -125,7 +125,7 @@ local -a _ffmpeg_argspecs lastopt_description=${lastopt_description//:/\\:} if [[ $example == filename ]]; then lastopt_takesargs=0 - lastopt+=":$lastopt_description:_files" + lastopt+=":${lastopt_description}:_files" elif [[ $lastopt == -[asv]pre ]]; then lastopt_takesargs=0 lastopt="*$lastopt" diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java index ff6e82645..b2352df7b 100644 --- a/Completion/Unix/Command/_java +++ b/Completion/Unix/Command/_java @@ -438,8 +438,8 @@ classpath|sourcepath|bootstrapclasspath|docletpath) compset -P '*:' compset -S ':*' _alternative \ - "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \ - "classpath:$state:_path_files -r': ' -/" && return + "classpath:${state}:_path_files -qS: -g '*.(jar|zip)(-.)'" \ + "classpath:${state}:_path_files -r': ' -/" && return ;; extdirs) diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 9a0328dca..ccaf310fa 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -139,7 +139,7 @@ _svn () { ;; (commit) args=( - ${args/(#b)(*--file*):arg:/$match[1]:file:_files} + ${args/(#b)(*--file*):arg:/${match[1]}:file:_files} '*:file: _svn_modified "committable"' ) ;; @@ -189,7 +189,7 @@ _svn () { args=( ':propname:(svn:ignore svn:keywords svn:executable svn:eol-style svn:mime-type svn:externals svn:needs-lock svn:global-ignores svn:auto-props)' ':propval:->propset_propval' - ${args/(#b)(*--file*):arg:/$match[1]:file:_files} + ${args/(#b)(*--file*):arg:/${match[1]}:file:_files} '*:path or url: _alternative "files:file:_files" "urls:URL:_svn_urls"' ) ;; diff --git a/Completion/Zsh/Command/_cd b/Completion/Zsh/Command/_cd index 961d121e0..9ca846c8f 100644 --- a/Completion/Zsh/Command/_cd +++ b/Completion/Zsh/Command/_cd @@ -73,7 +73,7 @@ else if zstyle -t ":completion:${curcontext}:path-directories" separate-sections; then local elem for ((elem=1; elem <= $#tmpcdpath; elem++)); do - alt+=( "path-directories-$elem:directory in $tmpcdpath[$elem]:_path_files -W 'tmpcdpath[$elem]' -/" ) + alt+=( "path-directories-${elem}:directory in ${tmpcdpath[$elem]}:_path_files -W 'tmpcdpath[$elem]' -/" ) done else (( $#tmpcdpath )) && -- cgit 1.4.1