From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15277 invoked from network); 2 Jul 2000 17:14:14 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 2 Jul 2000 17:14:14 -0000 Received: (qmail 21616 invoked by alias); 2 Jul 2000 17:14:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12133 Received: (qmail 21608 invoked from network); 2 Jul 2000 17:14:00 -0000 From: "Bart Schaefer" Message-Id: <1000702171355.ZM11193@candle.brasslantern.com> Date: Sun, 2 Jul 2000 17:13:54 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: PATCH: Problem with _expand, _path_files, and $(command) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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