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

Re: _complete_debug causes core dump.



On May 12,  5:07am, Tanaka Akira wrote:
} Subject: _complete_debug causes core dump.
}
} _complete_debug causes core dump as follows.

It's not _complete_debug, it's _message.  If you call _message when there
are no matches (which _complete_debug does in this case), makecomplist()
returns 1 and docompletion() derefs a null pointer.  If you don't call
_message (the case when _main_complete is called directly) makecomplist()
returns 0 and most of docompletion() is bypassed by a goto.

This did lead me to find a problem with _complete_debug, though.  The
change to the value of $w is just because I decided it looks nicer.

Index: Completion/Commands/_complete_debug
===================================================================
@@ -5,8 +5,9 @@
 
 (( $+_debug_count )) || integer -g _debug_count
 local tmp=${TMPPREFIX}${$}${words[1]:t}$[++_debug_count]
-local w="${(qqq)words}"
+local w="${(qq)words}"
 
+exec 3>&-	# Too bad if somebody else is using it ...
 [[ -t 2 ]] && exec 3>&2 2>| $tmp
 
 setopt xtrace
@@ -14,7 +15,7 @@
 integer ret=$?
 unsetopt xtrace
 
-[[ -t 2 ]] || {
+[[ -t 3 ]] && {
     ## Calling "print -s" during completion is presently broken.
     # _message -r "Trace output left in $tmp (up-history to view)"
     # print -sR "${VISUAL:-${EDITOR:-${PAGER:-more}}} $tmp ;: $w"



-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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