zsh-workers
 help / color / mirror / code / Atom feed
* Crash in copy-earlier-word
@ 2005-10-22 16:29 Mikael Magnusson
  2005-10-23 19:38 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2005-10-22 16:29 UTC (permalink / raw)
  To: zsh-workers

If i type a few words and then press copy-earlier-word a few times, i
get this backtrace. seems to be at or after it reaches the first word
on the line.

Program received signal SIGSEGV, Segmentation fault.
zlelineasstring (instr=0x0, inll=3, incs=3, outllp=0x8101760,
outcsp=0x810179c, useheap=0)
    at zle_utils.c:146
146		j = wctomb(s + mb_len, instr[i]);
(gdb) bt
#0  zlelineasstring (instr=0x0, inll=3, incs=3, outllp=0x8101760,
outcsp=0x810179c, useheap=0)
    at zle_utils.c:146
#1  0xa7bd31ce in metafy_line () at zle_tricky.c:943
#2  0xa7bbe999 in insertlastword (args=0xafae3d34) at zle_hist.c:538
#3  0xa7bc64c7 in execzlefunc (func=0xa7be4678, args=0xafae3d34) at
zle_main.c:1094
#4  0xa7bd267c in bin_zle_call (name=0xa7fd4570 "zle", args=0x3,
ops=0xafae3d80, func=0 '\0')
    at zle_thingy.c:696
#5  0xa7bd1738 in bin_zle (name=0xa7fd4570 "zle", args=0xafae3d30,
ops=0xafae3d80, func=0)
    at zle_thingy.c:382
#6  0x08053134 in execbuiltin (args=0xafae3d80, bn=0xa7be5f28) at builtin.c:439
#7  0x0807073e in execcmd (state=0xafae92a0, input=0, output=0,
how=18, last1=2) at exec.c:2558
#8  0x08071055 in execpline2 (state=0xafae92a0, pcode=0, how=18,
input=0, output=0, last1=0)
    at exec.c:1289
#9  0x08071623 in execpline (state=0xafae92a0, slcode=0, how=18,
last1=0) at exec.c:1075
#10 0x08072f93 in execlist (state=0xafae92a0, dont_change_job=1,
exiting=0) at exec.c:881
#11 0x08073971 in doshfunc (name=0x8148310 "copy-earlier-word", prog=0x82b3758,
    doshargs=0xa7a34a04, flags=0, noreturnval=1) at exec.c:781
#12 0xa7bc6402 in execzlefunc (func=0x8148000, args=0xa7be613c) at
zle_main.c:1129
#13 0xa7bc6b18 in zlecore () at zle_main.c:862
#14 0xa7bc759d in zleread (lp=0x8100fb0, rp=0x0, flags=3, context=3)
at zle_main.c:1016
#15 0x0808a4a4 in inputline () at input.c:278
#16 0x0808aaea in ingetc () at input.c:214
#17 0x08081017 in ihgetc () at hist.c:240
#18 0x08096576 in gettok () at lex.c:628
#19 0x08098236 in yylex () at lex.c:344
#20 0x080ba31a in parse_event () at parse.c:451
#21 0x0808733a in loop (toplevel=1, justonce=0) at init.c:128
#22 0x0808a054 in zsh_main (argc=1, argv=0xafae9b44) at init.c:1312
#23 0x08052aae in main (argc=3, argv=0x3) at main.c:93

--
Mikael Magnusson


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Crash in copy-earlier-word
  2005-10-22 16:29 Crash in copy-earlier-word Mikael Magnusson
@ 2005-10-23 19:38 ` Peter Stephenson
  2005-10-23 19:42   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2005-10-23 19:38 UTC (permalink / raw)
  To: zsh-workers

On Sat, 22 Oct 2005 18:29:04 +0200
Mikael Magnusson <mikachu@gmail.com> wrote:
> If i type a few words and then press copy-earlier-word a few times, i
> get this backtrace. seems to be at or after it reaches the first word
> on the line.

Thanks for spotting another one:  this was was because insertlastword()
wasn__t consistently remetafying the line if it returned in error.  I__ve
added another UMETACHECK() in the handler for the zle builtin so that
this sort of problem emerges a bit earlier.

I__ve already committed this because of problems with my ISP__s mail
server.

Index: Src/Zle/zle_hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_hist.c,v
retrieving revision 1.28
diff -u -r1.28 zle_hist.c
--- Src/Zle/zle_hist.c	26 Sep 2005 18:39:21 -0000	1.28
+++ Src/Zle/zle_hist.c	23 Oct 2005 17:14:57 -0000
@@ -577,13 +577,17 @@
 	 * a deleted word, because that can only have come
 	 * from a non-empty line.  I think.
 	 */
-	if (!(l = bufferwords(NULL, NULL, NULL)))
+	if (!(l = bufferwords(NULL, NULL, NULL))) {
+	    unmetafy_line();
 	    return 1;
+	}
 	nwords = countlinknodes(l);
     } else {
 	/* Some stored line. */
-	if (!(he = quietgethist(evhist)) || !he->nwords)
+	if (!(he = quietgethist(evhist)) || !he->nwords) {
+	    unmetafy_line();
 	    return 1;
+	}
 	nwords = he->nwords;
     }
     if (wordpos) {
@@ -602,6 +606,7 @@
 	 * has not changed, and lastinsert is still valid.
 	 */
 	lasthist = evhist;
+	unmetafy_line();
 	return 1;
     }
     /*
Index: Src/Zle/zle_thingy.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_thingy.c,v
retrieving revision 1.19
diff -u -r1.19 zle_thingy.c
--- Src/Zle/zle_thingy.c	29 Sep 2005 17:32:38 -0000	1.19
+++ Src/Zle/zle_thingy.c	23 Oct 2005 17:14:58 -0000
@@ -358,6 +358,8 @@
     struct opn const *op, *opp;
     int n;
 
+    UNMETACHECK();
+
     /* select operation and ensure no clashing arguments */
     for(op = opns; op->o && !OPT_ISSET(ops,STOUC(op->o)); op++) ;
     if(op->o)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Crash in copy-earlier-word
  2005-10-23 19:38 ` Peter Stephenson
@ 2005-10-23 19:42   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2005-10-23 19:42 UTC (permalink / raw)
  To: zsh-workers

On Sun, 23 Oct 2005 20:38:37 +0100
Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> Thanks for spotting another one:  this was was because insertlastword()
> wasn__t consistently remetafying the line if it returned in error.
      ^^
      sorry, another variant of the previous problem...  you don't want
to know the details.  I'll look into it.

pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-10-23 19:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-22 16:29 Crash in copy-earlier-word Mikael Magnusson
2005-10-23 19:38 ` Peter Stephenson
2005-10-23 19:42   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).