* menu-select crashes and redraw problems
@ 2007-12-23 6:24 Mikael Magnusson
2008-02-28 23:10 ` Peter Stephenson
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2007-12-23 6:24 UTC (permalink / raw)
To: zsh-workers
When i use menu-select and resize the terminal while the select is
going on (no, I don't usually do this :) ), zsh usually crashes after
a couple of tries. It almost always messes up the display of the list
after a resize, sometimes it fixes itself when you scroll around,
sometimes not. I reproduced it with zsh -f like this
zsh -f
zmodload zsh/complist
ls <alt-x>menu-select<enter>
<scroll around a bit, preferably to a second or higher column>*
<resize terminal narrower so the column with the cursor disappears>
<scroll around a bit more>
<repeat from * until zsh crashes>
(gdb) bt full
#0 0xa7e65f83 in strlen () from /lib/libc.so.6
No symbol table info available.
#1 0x08101475 in instmatch (m=0x8183548, scs=0xafd5df08) at compresult.c:607
p = <value optimized out>
r = 10
ocs = <value optimized out>
a = 3
brb = <value optimized out>
bradd = <value optimized out>
brpos = <value optimized out>
bp = <value optimized out>
#2 0x0810303b in do_single (m=0x8183548) at compresult.c:989
l = <value optimized out>
sr = <value optimized out>
scs = <value optimized out>
havesuff = <value optimized out>
partest = 1
str = 0x746c75 <Address 0x746c75 out of bounds>
psuf = 0x8147e83 ""
prpre = 0x8147e83 ""
#3 0x08108592 in domenuselect (dummy=0x0, dat=0x0) at complist.c:3166
omline = 39
p = (Cmatch **) 0x0
pg = (Cmgroup *) 0x81b8ec8
cmd = (Thingy) 0x814fb80
do_last_key = 1
u = (Menustack) 0x0
i = <value optimized out>
acc = <value optimized out>
wishcol = 39
---Type <return> to continue, or q <return> to quit---
setwish = 0
oe = 0
wasnext = 0
lbeg = 2
step = 1
wrap = 0
pl = 2
broken = <value optimized out>
first = 0
nolist = 0
mode = 0
modecs = 13
modell = 13
modelen = 10
wasmeta = 0
s = 0x36 <Address 0x36 out of bounds>
status = "\000\000\000\000Èø\024\bØäկ\002", '\0' <repeats 31 times>,
"a|\022\bPãկ\000\000\000\000Èøû§\003\000\000\000_1\030\b\001", '\0'
<repeats 11 times>,
"X@\027\b@*\030\b\000\000\000\000¸1\030\b\023\000\000\000\b\000\000\000\000ãկ\025\213\022\b¸1\030\b\000\000\000\000\000\000\000\000@*\030\b"
modeline = 0xa7fbf878 "ls aclocal.m4"
fdat = (Chdata) 0x0
lastsearch = 0x0
#4 0x0810a518 in menuselect (args=0x8166384) at complist.c:3226
d = 1
#5 0x08120784 in execzlefunc (func=0x817ad58, args=0x8166384,
set_bindk=0) at zle_main.c:1273
ret = <value optimized out>
w = (Widget) 0x817a4d0
save_bindk = (Thingy) 0x817ad58
#6 0x08120c60 in zlecore () at zle_main.c:1030
No locals.
---Type <return> to continue, or q <return> to quit---
#7 0x08121243 in zleread (lp=0x816719c, rp=0x0, flags=3, context=0)
at zle_main.c:1186
s = <value optimized out>
old_errno = 2
initthingy = (Thingy) 0x0
#8 0x0807b59a in inputline () at input.c:278
flags = 1634100580
ingetcline = <value optimized out>
ingetcpmptl = (char **) 0x0
ingetcpmptr = (char **) 0x0
context = 0
#9 0x0807bc89 in ingetc () at input.c:214
lastc = <value optimized out>
#10 0x08075997 in ihgetc () at hist.c:240
c = <value optimized out>
#11 0x0808576b in yylex () at lex.c:663
No locals.
#12 0x080a49aa in parse_event () at parse.c:451
No locals.
#13 0x08079fd4 in loop (toplevel=1, justonce=0) at init.c:129
prog = (Eprog) 0xa7fbf630
#14 0x0807b04e in zsh_main (argc=2, argv=0xafd5ee94) at init.c:1352
arg0 = <value optimized out>
t = <value optimized out>
t0 = <value optimized out>
#15 0x0804d312 in main (argc=Cannot access memory at address 0x0
) at ./main.c:93
No locals.
I see now that it says value optimized out in a few places, let me try
with -O0...
bingo
Program received signal SIGSEGV, Segmentation fault. ls MACHINES
0x08108f68 in instmatch (m=0x818f448, scs=0xafa62130) at compresult.c:607
607 inststrlen(m->str, 1, (l = strlen(m->str))); install-sh
/me presses ctrl-l
(gdb) bt full
#0 0x08108f68 in instmatch (m=0x818f448, scs=0xafa62130) at compresult.c:607
l = 10
r = 10
ocs = 135770816
a = 3
brb = 0
bradd = 0
brpos = (int *) 0x0
bp = (Brinfo) 0xafa62138
#1 0x08109e11 in do_single (m=0x818f448) at compresult.c:989
l = 8
sr = 0
scs = 0
havesuff = 0
partest = 1
str = 0x746c75 <Address 0x746c75 out of bounds>
ppre = 0x818f4c8 "aclocal.m4"
psuf = 0x81516a2 ""
prpre = 0x81516a2 ""
#2 0x08116a8f in domenuselect (dummy=0x0, dat=0x0) at complist.c:3166
p = (Cmatch **) 0x81c1e58
pg = (Cmgroup *) 0x81c2a94
cmd = (Thingy) 0x815cf58
do_last_key = 0
u = (Menustack) 0x0
i = 1
acc = 0
wishcol = 76
setwish = 0
oe = 0
wasnext = 0
space = 37
lbeg = 0
step = 1
wrap = 0
pl = 2
broken = 0
---Type <return> to continue, or q <return> to quit---
first = 0
nolist = 0
mode = 0
modecs = 13
modell = 13
modelen = 10
wasmeta = 0
s = 0x0
status = "\000\225\020\b\214$¦¯°$¦¯T\021\034\b\fé\030\b\234º\025\b\fé\030\b¨$¦¯àç\030\b\214$¦¯\000\000\000\000¨$¦¯\000\000\000\000ôOð§U\021\034\b\000uߧø$¦¯\203Ú䧸Æ\027\b¼$¦¯à$¦¯U\021\034\b\000\000\000\000ä$¦¯\000\000\000\000\001\000\000\000\bé\030\bLað§
að§Lað§\000\000\000\000Pað§"
modeline = 0xa7fa07d0 "ls aclocal.m4"
fdat = (Chdata) 0x0
lastsearch = 0x0
#3 0x08116dc3 in menuselect (args=0x8172864) at complist.c:3226
d = 1
#4 0x0812c44b in execzlefunc (func=0x8186d48, args=0x8172864,
set_bindk=0) at zle_main.c:1273
wflags = 645
r = 0
ret = 0
w = (Widget) 0x81864c0
save_bindk = (Thingy) 0x8186d48
#5 0x0812baf7 in zlecore () at zle_main.c:1030
No locals.
#6 0x0812c0ec in zleread (lp=0x817367c, rp=0x0, flags=3, context=0)
at zle_main.c:1186
s = 0x0
old_errno = 2
tmout = 0
initthingy = (Thingy) 0x0
#7 0x0807fce4 in inputline () at input.c:278
flags = 3
ingetcline = 0x0
ingetcpmptl = (char **) 0x817367c
ingetcpmptr = (char **) 0x0
context = 0
#8 0x0807fb63 in ingetc () at input.c:214
---Type <return> to continue, or q <return> to quit---
lastc = -1478476541
#9 0x08075c59 in ihgetc () at hist.c:240
c = 3
#10 0x08087f49 in gettok () at lex.c:663
c = 0
d = 0
peekfd = -1
peek = 0
#11 0x080877d2 in yylex () at lex.c:350
No locals.
#12 0x080a3d2a in parse_event () at parse.c:451
No locals.
#13 0x0807c3d1 in loop (toplevel=1, justonce=0) at init.c:129
prog = (Eprog) 0xa7fa05f8
#14 0x0807f7a5 in zsh_main (argc=2, argv=0xafa62b94) at init.c:1352
t = (char **) 0xafa62b9c
t0 = 157
#15 0x0804d366 in main (argc=Cannot access memory at address 0xffffffff
) at ./main.c:93
No locals.
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: menu-select crashes and redraw problems
2007-12-23 6:24 menu-select crashes and redraw problems Mikael Magnusson
@ 2008-02-28 23:10 ` Peter Stephenson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2008-02-28 23:10 UTC (permalink / raw)
To: zsh-workers
On Sun, 23 Dec 2007 07:24:48 +0100
"Mikael Magnusson" <mikachu@gmail.com> wrote:
> When i use menu-select and resize the terminal while the select is
> going on (no, I don't usually do this :) ), zsh usually crashes after
> a couple of tries. It almost always messes up the display of the list
> after a resize, sometimes it fixes itself when you scroll around,
> sometimes not. I reproduced it with zsh -f like this
>
> zsh -f
> zmodload zsh/complist
> ls <alt-x>menu-select<enter>
> <scroll around a bit, preferably to a second or higher column>*
> <resize terminal narrower so the column with the cursor disappears>
> <scroll around a bit more>
> <repeat from * until zsh crashes>
After an hour or two chasing red herrings around gum trees, I came up
with this. It's not the end of the story, since the display seems to
get messed up occasionally, but it does seem to reduce or possibly
eliminate crashes. This is one of those "please don't ask me what it
does" fixes, but I think the story is cases like this are mostly handled
and it simply didn't try quite as hard as it could to fix up lines and
columns.
I suspect that in principle there are horrific races such that if
SIGWINCH arrives when the code is anywhere other than waiting for a key
press pretty much anything can happen. I am successfully ignoring this
so far and hope to continue doing so.
As you'll see in the first hunk, I've added a detailed explanatory
comment to one of the many sophisticated features of the code.
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.107
diff -u -r1.107 complist.c
--- Src/Zle/complist.c 15 Feb 2008 22:01:05 -0000 1.107
+++ Src/Zle/complist.c 28 Feb 2008 22:51:40 -0000
@@ -122,7 +122,11 @@
int mgtabsize;
#endif
-/* Used in mtab/mgtab, for explanations. */
+/*
+ * Used in mtab/mgtab, for explanations.
+ *
+ * UUUUUUUUUUUUUUURRRRGHHHHHHHHHH!!!!!!!!! --- pws
+ */
#define MMARK ((unsigned long) 1)
#define mmarked(v) (((unsigned long) (v)) & MMARK)
@@ -2325,8 +2329,7 @@
for (;;) {
METACHECK();
- mtab_been_reallocated = 0;
- if (mline < 0) {
+ if (mline < 0 || mtab_been_reallocated) {
int x, y;
Cmatch **p = mtab;
@@ -2342,6 +2345,7 @@
if (y < mlines)
mline = y;
}
+ mtab_been_reallocated = 0;
DPUTS(mline < 0,
"BUG: mline < 0 after re-scanning mtab in domenuselect()");
while (mline < mlbeg)
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-02-28 23:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-23 6:24 menu-select crashes and redraw problems Mikael Magnusson
2008-02-28 23:10 ` 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).