Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Problem with _expand, _path_files, and $(command)
- X-seq: zsh-workers 12133
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: Problem with _expand, _path_files, and $(command)
- Date: Sun, 2 Jul 2000 17:13:54 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
The first problem is that the stderr of the command messes up the display.
Then if the command doesn't produce any output, assorted bad things happen
at line 80 of _expand:
zagzig[120] echo $(stty -a)stty: standard input: Inappropriate ioctl for device
_expand:80: unknown file attribute
zagzig[121] echo $(exit 0)
_expand:80: missing end of string
Both of those examples break _complete_debug, because they're treated as
fatal errors (just like the problem we were having with ${(e)garbage} a
while ago).
If I remove _expand from the completer style, I get this:
zagzig[86] echo $(exit 0)
_path_files:325: missing end of string
After the patch below, there's still a problem with _path_files, because
the parens in $(exit 0) are interpreted as enclosing a glob qualifier, so
something else goes haywire:
zagzig[88] echo $(exit 0)
zagzig[88] echo \$\*\(exit\ 0Om\)
Of course the best thing to do at lines 64-66 of _expand, would be to
capture the standard error of the $(...) and use `_message -r' to display
it. However, I can't think of any way to capture stderr that wouldn't
cause the entire exp=(...) to be forced into a subshell, except by using
a temp file, which is unacceptable overhead in the "normal" case.
--- zsh-forge/current/Completion/Core/_expand Thu Jun 29 01:32:02 2000
+++ zsh-3.1.9/Completion/Core/_expand Sun Jul 2 09:35:37 2000
@@ -63,7 +63,7 @@
eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \)
exp=( ${${(e)exp//\\[
]/ }//(#b)([
-])/\\$match[1]} )
+])/\\$match[1]} ) 2>/dev/null
else
exp=( ${exp:s/\\\$/\$} )
fi
@@ -77,7 +77,7 @@
# Now try globbing.
[[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob &&
- exp=( ${~exp} )
+ eval 'exp=( ${~exp} )' 2>/dev/null
# If we don't have any expansions or only one and that is the same
# as the original string, we let other completers run.
--- zsh-forge/current/Completion/Core/_path_files Mon Jun 19 09:47:27 2000
+++ zsh-3.1.9/Completion/Core/_path_files Sun Jul 2 09:29:39 2000
@@ -322,7 +322,7 @@
else
compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher" '' fake "$pats[@]"
fi
- tmp1=( $~tmp1 )
+ eval 'tmp1=( $~tmp1 )' 2>/dev/null
if [[ -n "$PREFIX$SUFFIX" ]]; then
# See which of them match what's on the line.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author