Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Failed process substitution on x=$~y (Re: Unexpected foo==bar errors)
- X-seq: zsh-workers 37972
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Failed process substitution on x=$~y (Re: Unexpected foo==bar errors)
- Date: Sun, 14 Feb 2016 12:10:12 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;        h=from:message-id:date:in-reply-to:comments:references:to:subject         :mime-version:content-type;        bh=k6lhk42lPjTd7SQ2idwLU35IIc2GYiHB8MrmJwsL+z8=;        b=FQYQ+MfOPLk0BWsoXWlfveFnl1OckQzlJFG5lMjh3UgRSnKbMAyuMGJyaJdk6ksBKi         DUcXabMJcb6NpCbghFiMpVJSfQLY6KvH1NMFeMfgV10fNW/XU3S/Ff1OVg9ByjC7zHQF         IWJ8k5m/PSzMZeNn937+I5Fzz/tyfffJqjoNXv/mmGKnw4vA4Jv7m5XoWGOibspEvEkP         DJZzd5+YbLP+ACsfYO7Utihwkx79ZCWJyDlFKIEJCBp6mG0q9ZoIkEGqk4fZUUKBp16g         wRJfQjh/tl4HRzvBSVVZDJRJE+EiDFlPQRunnwnOLu2RCed2vrNP77bHGr/go0EqXAaQ         E04g==
- In-reply-to: <CAHYJk3R6TPvc9mSRv8ERi5Uo=GKgzbAZBJ1V7uEt42QnsJUfQg@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAHYJk3QRVQ893fMP+4CmdapK10vx5gP581pY358KSQdR1-sZuQ@mail.gmail.com> 	<160207111638.ZM30626@torch.brasslantern.com> 	<CAHYJk3S-Vj24041msXn6f8w3DM1pbv2uooxHUF3F=Ou8od_PxQ@mail.gmail.com> 	<160208104528.ZM12107@torch.brasslantern.com> 	<CAHYJk3R6TPvc9mSRv8ERi5Uo=GKgzbAZBJ1V7uEt42QnsJUfQg@mail.gmail.com>
On Feb 8,  8:16pm, Mikael Magnusson wrote:
} Subject: Re: Unexpected foo==bar errors
}
} On Mon, Feb 8, 2016 at 7:45 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > On Feb 8,  4:52am, Mikael Magnusson wrote:
} > } I wonder if there's anywhere in the completion system that depends on
} > } EQUALS being set... But maybe we should just 2> /dev/null the
} > } assignment since tilde expansion also prints errors. (_zattr and _zip
} > } also have this issue, presumably there are other places as well).
Looks like stderr is already redirected in _zattr.
} Well, considering that something simple as foo*.tar (expanding only to
} one file) also leaves $tf empty, I'd say it's better to leave $tf
} empty for any weird command substitutions as well, but suppress the
} error messages.
The following all use ${~param} in places where an error could occur if
the value looks like a process substitution:
   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
If for some reason one used a process substitution to locate the muttrc
file, Completion/Unix/Type/_mailboxes might also have that issue, but I
think that's wildly unlikely.
Some of these might warrant a closer look to see if it's a larger issue
to proceed with the resulting empty string.
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
index 87fb20e..687c0c4 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 7431a48..3150ffc 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 68d1c91..e72cf5e 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 2800f4a..dbc64f8 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 48befa7..c3f3961 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 c6ede9e..1f8f62c 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 1e99ac0..4a24048 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 171daf0..1040fa9 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 d23b913..e4a725b 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author