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

segfault in 3.1.6 in completion



Please copy me in any replies.

Start 3.1.6 with no init files and load the below attached completion
functions.  Now if you go into a directory containing CVS controlled
files and try

  % cvstest foobar/

(where foobar is some directory) and hit TAB you get a crash 

Program received signal SIGSEGV, Segmentation fault.

#0  0x809fc6d in makecomplistflags ()
#1  0x809d53b in makecomplistlist ()
#2  0x809d4bf in makecomplistor ()
#3  0x809d43a in makecomplistcc ()
#4  0x809d362 in makecomplistcmd ()
#5  0x809d1e1 in makecomplistglobal ()
#6  0x809bea3 in makecomplist ()
#7  0x809abb8 in docompletion ()
#8  0x80949f3 in docomplete ()
#9  0x809398e in expandorcomplete ()
#10 0x808d67c in execzlefunc ()
#11 0x808d3d6 in zleread ()
#12 0x8063e7d in inputline ()
#13 0x8063dc5 in ingetc ()
#14 0x805f6a9 in ihgetc ()
#15 0x80674e7 in gettok ()
#16 0x8066ffe in yylex ()
#17 0x8071d3c in parse_event ()
#18 0x8062601 in loop ()
#19 0x804a73a in main ()

Unfortunately I didn't build with debugging on and don't have time
right now.  Figured I'd send this first just in case it's already been
fixed..

If there is no directory (ie complete file in current directory), or
if you disable the "-y _cvscompletions", it works fine.

thanks,

Greg


# mostly stolen from the zsh distribution

compctl -/K _cvstargets -y _cvscompletions cvstest 

_cvsprefix () { 
  local nword args f
  read -nc nword; read -Ac args
  pref=$args[$nword]
  if [[ -d $pref:h && ! -d $pref ]]; then
    pref=$pref:h
  elif [[ $pref != */* ]]; then
    pref=
  fi
  [[ -n "$pref" && "$pref" != */ ]] && pref=$pref/
}

_cvsentries () { 
  setopt localoptions nullglob unset
  if [[ -f ${pref}CVS/Entries ]]; then
    reply=( "${pref}${^${(@)${(@)${(@)${(f@)$(<${pref}CVS/Entries)}:#D*}#/}%%/*}[@]}" )
  fi
}

_cvscompletions () { 
  setopt localoptions noksharrays
  local c cc
  reply=( )
  for c in $@ ; do
    cc="${c##*/}"
    [[ -d "$c" ]] && cc="$cc/"
    reply=( $reply[@] $cc )
  done
}

_cvstargets () {
  setopt localoptions noksharrays
  local pref
  _cvsprefix
  _cvsentries
}



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