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

PATCH: obscure crash



hasbrpsfx() in compresult.c can be called from the display code
when the current completion line is in the wide character form,
but it expects the other form.

This was quite hard to trigger; I had to do accept-and-menu-complete
three times on a non-trivial completion (actually after "p4 revert",
so it's difficult even to set up).  It didn't seem to happen with normal
file completion.

Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.68
diff -u -r1.68 compresult.c
--- Src/Zle/compresult.c	7 Oct 2006 08:05:03 -0000	1.68
+++ Src/Zle/compresult.c	30 Oct 2006 12:52:45 -0000
@@ -683,11 +683,19 @@
 mod_export int
 hasbrpsfx(Cmatch m, char *pre, char *suf)
 {
-    METACHECK();
+    int was_meta;
+
+    /* May not be metafied if calculating whether to show a list. */
+    if (zlemetaline == NULL) {
+	was_meta = 0;
+	metafy_line();
+    } else
+	was_meta = 1;
 
     if (m->flags & CMF_ALL)
 	return 1;
-    else {
+
+    {
 	char *op = lastprebr, *os = lastpostbr;
 	VARARR(char, oline, zlemetall);
 	int oll = zlemetall, ocs = zlemetacs, ole = lastend, opcs = brpcs, oscs = brscs, ret;
@@ -717,6 +725,8 @@
 	lastprebr = op;
 	lastpostbr = os;
 
+	if (!was_meta)
+	    unmetafy_line();
 	return ret;
     }
 }

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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