From 485cbbb6cc6ac9d7c13a8268b3574829026f3797 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 14 Feb 2016 13:10:06 -0800 Subject: 37972: Redirect stderr to /dev/null in cases where ${~param} might generate errors --- ChangeLog | 9 +++++++++ Completion/Base/Utility/_arguments | 2 +- Completion/Base/Widget/_correct_filename | 2 +- Completion/Base/Widget/_most_recent_file | 2 +- Completion/Unix/Command/_devtodo | 2 +- Completion/Unix/Command/_make | 2 +- Completion/Unix/Command/_ssh | 2 +- Completion/Unix/Command/_tar | 2 +- Completion/Unix/Command/_zip | 2 +- Completion/Unix/Type/_canonical_paths | 2 +- 10 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a081f0ad4..b0ba429c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-02-14 Barton E. Schaefer + * 37972: Completion/Base/Utility/_arguments, + Completion/Base/Widget/_correct_filename, + Completion/Base/Widget/_most_recent_file, + Completion/Unix/Command/_devtodo, Completion/Unix/Command/_make, + Completion/Unix/Command/_ssh, Completion/Unix/Command/_tar, + Completion/Unix/Command/_zip, + Completion/Unix/Type/_canonical_paths: Redirect stderr to + /dev/null in cases where ${~param} might generate errors + * 37971 (cf. users/21284: Eric Freese): Functions/Zle/bracketed-paste-magic: fix potential issues when interacting with user-defined widgets diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index 87fb20e6b..687c0c4ed 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -36,7 +36,7 @@ if (( long )); then tmpargv=( "${(@)argv[1,long-1]}" ) # optspec's before --, if any - name=${~words[1]} + name=${~words[1]} 2>/dev/null [[ "$name" = [^/]*/* ]] && name="$PWD/$name" name="_args_cache_${name}" diff --git a/Completion/Base/Widget/_correct_filename b/Completion/Base/Widget/_correct_filename index 7431a4831..3150ffcdb 100644 --- a/Completion/Base/Widget/_correct_filename +++ b/Completion/Base/Widget/_correct_filename @@ -28,7 +28,7 @@ fi if [[ $file = \~*/* ]]; then tilde=${file%%/*} - etilde=${~tilde} + etilde=${~tilde} 2>/dev/null file=${file/#$tilde/$etilde} fi diff --git a/Completion/Base/Widget/_most_recent_file b/Completion/Base/Widget/_most_recent_file index 68d1c91a2..e72cf5e8d 100644 --- a/Completion/Base/Widget/_most_recent_file +++ b/Completion/Base/Widget/_most_recent_file @@ -11,7 +11,7 @@ local file tilde etilde if [[ $PREFIX = \~*/* ]]; then tilde=${PREFIX%%/*} - etilde=${~tilde} + etilde=${~tilde} 2>/dev/null # PREFIX and SUFFIX have full command line quoting in, but we want # any globbing characters which are quoted to stay quoted. eval "file=($PREFIX*$SUFFIX(om[${NUMERIC:-1}]N))" diff --git a/Completion/Unix/Command/_devtodo b/Completion/Unix/Command/_devtodo index 2800f4a31..dbc64f870 100644 --- a/Completion/Unix/Command/_devtodo +++ b/Completion/Unix/Command/_devtodo @@ -9,7 +9,7 @@ typeset expl for ((i=2; i <= $#words; i++)) { if [[ $words[$i] == '--database' ]]; then - todo_opts+=(--database ${~words[$((++i))]}) + todo_opts+=(--database ${~words[$((++i))]}) 2>/dev/null elif [[ $words[$i] == '--sort' ]]; then todo_opts+=(--sort ${words[$((++i))]}) fi diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index 48befa749..c3f3961c9 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -129,7 +129,7 @@ _make-findBasedir () { do if [[ $@[index] == -C ]] then - file=${~@[index+1]}; + file=${~@[index+1]} 2>/dev/null if [[ -z $file ]] then # make returns with an error if an empty arg is given diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index c6ede9efe..1f8f62cac 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -622,7 +622,7 @@ _ssh_hosts () { ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return fi if (( ind = ${words[(I)-F]} )); then - config=${~words[ind+1]} + config=${~words[ind+1]} 2>/dev/null else config="$HOME/.ssh/config" fi diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index 1e99ac013..4a2404873 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -79,7 +79,7 @@ else tf=${~words[tmp+1]} _tar_cmd="f$_tar_cmd" fi -fi +fi 2>/dev/null # See if we should use a path prefix. We have to use eval as the dir can # be any unevaluated thing which appears on the command line, including a diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip index 171daf01e..1040fa977 100644 --- a/Completion/Unix/Command/_zip +++ b/Completion/Unix/Command/_zip @@ -120,7 +120,7 @@ case $state in zipfile=$testfile.ZIP else return 1 - fi + fi 2>/dev/null if [[ $zipfile != $_zip_cache_name ]]; then _zip_cache_name="$zipfile" _zip_cache_list=( ${(f)"$(zipinfo -1 $_zip_cache_name)"} ) diff --git a/Completion/Unix/Type/_canonical_paths b/Completion/Unix/Type/_canonical_paths index d23b913ef..e4a725b2b 100644 --- a/Completion/Unix/Type/_canonical_paths +++ b/Completion/Unix/Type/_canonical_paths @@ -61,7 +61,7 @@ _canonical_paths_get_canonical_path() { _canonical_paths_add_paths () { local origpref=$1 expref rltrim curpref canpref subdir [[ $2 != add ]] && matches=() - expref=${~origpref} + expref=${~origpref} 2>/dev/null [[ $origpref == (|*/). ]] && rltrim=. curpref=${${expref%$rltrim}:-./} if zstat $curpref >&/dev/null; then -- cgit 1.4.1