Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

globcomplete bug + bug when compctl.so not loaded + init patch



Looks like things go haywire when globcomplete is set with new completion.

% _foo() { complist -k '(one two)'; }
% defcomp _foo foo
% setopt globcomplete
% foo o*e<TAB>

The shell hangs and has to be got rid of with kill -9.  It looks like it's
happening during the complist.  


I tried to reproduce this with zsh -f (and succeeded eventually), but got
another bug --- well two, actually.  First I had to apply the patch at the
end to get the _* files to match properly; plus I needed to fix up some
nullglob flags in init and dump else dump miscounted the number of files; I
also made dump produce an alphabetic order (I never realised `whence' just
dumped the table out without ordering, but maybe I should have).

Then the following happened.

% fpath=(~/bin/comp)
% . ~/bin/comp/init
% setopt glob<TAB>
zsh: 19372 illegal hardware instruction (core dumped)  ./zsh -f

It looks like this is because compctl.so has never been loaded, so that
makecompparamsptr never got defined.  Probably this ought to be checked for
somewhere.

--- Functions/Completion/dump.bk	Fri Feb 19 14:38:12 1999
+++ Functions/Completion/dump	Wed Feb 24 14:39:26 1999
@@ -16,7 +16,7 @@
 
 _d_file=${COMPDUMP-${0:h}/init.dump}
 
-_d_files=( ${^~fpath}/_*~*~ )
+_d_files=( ${^~fpath}/_*~*~(N) )
 
 print "#files: $#_d_files" > $_d_file
 
@@ -26,7 +26,7 @@
 # ensure that a single quote inside a variable is itself correctly quoted.
 
 print "comps=(" >> $_d_file
-for _d_f in ${(k)comps}; do
+for _d_f in ${(ok)comps}; do
     print -r - "'${_d_f//\'/'\\''}'" "'${comps[$_d_f]//\'/'\\''}'"
 done  >> $_d_file
 print ")" >> $_d_file
@@ -66,16 +66,16 @@
 # Autoloads: whence -w produces "_d_foo: function", so look for
 # all functions beginning with `_'.
 
-_d_als=($(whence -wm '_*' |
+_d_als=($(whence -wm '_*' | sort |
 while read -rA _d_line; do
   [[ ${_d_line[2]} = function ]] && print -r - ${_d_line[1]%:}
 done))
 
-# print them out:  about six to a line looks neat
+# print them out:  about five to a line looks neat
 
 while (( $#_d_als )); do
   print -n autoload
-  for (( _i = 0; _i < 6; _i++ )); do
+  for (( _i = 0; _i < 5; _i++ )); do
     if (( $#_d_als )); then
       print -n " $_d_als[1]"
       shift _d_als
--- Functions/Completion/init.bk	Tue Feb 23 14:56:17 1999
+++ Functions/Completion/init	Wed Feb 24 14:39:26 1999
@@ -170,7 +170,12 @@
 
 : ${COMPDUMP:=$0.dump}
 
-_i_files=( ${^~fpath}/_*~*~ )
+if [[ ! -o extendedglob ]]; then
+  _i_noextglob=yes
+  setopt extendedglob
+fi
+
+_i_files=( ${^~fpath}/_*~*~(N) )
 _i_initname=$0
 _i_done=''
 
@@ -185,10 +190,6 @@
   unset _i_line
 fi
 if [[ -z "$_i_done" ]]; then
-  if [[ ! -o extendedglob ]]; then
-    _i_noextglob=yes
-    setopt extendedglob
-  fi
   for _i_dir in $fpath; do
     [[ $_i_dir = . ]] && continue
     for _i_file in $_i_dir/_*~*~(N); do
@@ -222,13 +223,13 @@
       fi
     done
 
-  [[ -z "$_i_noextglob" ]] || unsetopt extendedglob
-
-  unset _i_dir _i_line _i_file _i_tag _i_noextglob
+  unset _i_dir _i_line _i_file _i_tag
 
   # If autodumping was requested, do it now.
 
   (( _i_autodump )) && builtin . ${_i_initname:h}/dump
 fi
 
-unset _i_files _i_initname _i_done _i_autodump
+[[ -z "$_i_noextglob" ]] || unsetopt extendedglob
+
+unset _i_files _i_initname _i_done _i_autodump _i_noextglob

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author