From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: erik quanstrom Date: Thu, 12 Mar 2009 11:33:41 -0400 To: 9fans@9fans.net MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] drawterm crash. small fix. bug remains? Topicbox-Message-UUID: b9d8e974-ead4-11e9-9d60-3106f5b1d025 ignominously, i am dealing with an x86_64 linux machine with 64-bit linux. this always crashes drawterm 1. create new rio window 2. put window in hold mode 3. cut from an x application 4. paste into drawterm window from #2. this change stopped it from crashing. i don't know if this is a recent change to the x11 headers. diff -c x11.c /root/drawterm/gui-x11/ x11.c:1426,1432 - /root/drawterm/gui-x11//x11.c:1426,1432 uchar *data, *xdata; Atom clipboard, type, prop; unsigned long lastlen; - unsigned long dummy, len; + uint dummy, len; int fmt, i; Window w; but i'm not fully convinced that it's all better. i may just be masking the problem. notice that c->aux == c in the following debugging output. it may be just a coincidence, but i'm not so sure. (gdb) r Starting program: /root/drawterm/drawterm --c ladd [Thread debugging using libthread_db enabled] [New Thread 0x7f855c18c6f0 (LWP 9620)] [New Thread 0x42455950 (LWP 9621)] [New Thread 0x42c56950 (LWP 9627)] [New Thread 0x43457950 (LWP 9628)] [New Thread 0x43c58950 (LWP 9629)] [New Thread 0x44459950 (LWP 9630)] [New Thread 0x412be950 (LWP 9631)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x43c58950 (LWP 9629)] 0x000000000040aefa in consread (c=0x7f8500000000, buf=0x6e36a0, n=, off=0) at devcons.c:762 762 c->aux = clipread(); (gdb) print c $1 = (Chan *) 0x7f8500000000 (gdb) print *c Cannot access memory at address 0x7f8500000000 (gdb) where #0 0x000000000040aefa in consread (c=0x7f8500000000, buf=0x6e36a0, n=, off=0) at devcons.c:762 #1 0x00000000004125f7 in kread (fd=, buf=0x6e36a0, n=, offp=0x43c57b90) at sysfile.c:408 #2 0x0000000000412665 in _syspread (fd=6877216, buf=0x7f855b830320, n=7388928, off=0) at sysfile.c:435 #3 0x0000000000412722 in syspread (fd=10, buf=0x6e36a0, n=1024, off=0) at sysfile.c:1046 #4 0x0000000000425356 in slaveread (p=0x6b8770) at exportsrv.c:606 #5 0x00000000004256f9 in blockingslave (x=) at exportsrv.c:496 #6 0x0000000000415173 in tramp (vp=) at posix.c:130 #7 0x00007f855ba6c097 in start_thread () from /lib/libpthread.so.0 #8 0x00007f855b7e3ccd in clone () from /lib/libc.so.6 #9 0x0000000000000000 in ?? () (gdb) up #1 0x00000000004125f7 in kread (fd=, buf=0x6e36a0, n=, offp=0x43c57b90) at sysfile.c:408 408 n = devtab[c->type]->read(c, buf, n, off); (gdb) p c $2 = (Chan *) 0x7f8554001960 (gdb) up #2 0x0000000000412665 in _syspread (fd=6877216, buf=0x7f855b830320, n=7388928, off=0) at sysfile.c:435 435 return kread(fd, buf, n, &off); (gdb) down #1 0x00000000004125f7 in kread (fd=, buf=0x6e36a0, n=, offp=0x43c57b90) at sysfile.c:408 408 n = devtab[c->type]->read(c, buf, n, off); (gdb) p c->type $3 = 1 (gdb) p c $4 = (Chan *) 0x7f8554001960 (gdb) p c->aux $5 = (void *) 0x7f8554001670 (gdb) p *c $6 = {ref = {lk = {key = 0}, ref = 2}, next = 0x0, link = 0x7f8554001870, offset = 0, type = 1, dev = 0, mode = 0, flag = 1, qid = {path = 19, vers = 0, type = 0 '\0'}, fid = 133, iounit = 0, umh = 0x0, umc = 0x0, umqlock = {lk = { key = 0}, hold = 0x0, first = 0x0, last = 0x0}, uri = 0, dri = 0, mountid = 0, mcp = 0x0, mux = 0x0, aux = 0x7f8554001670, pgrpid = {path = 0, vers = 0, type = 0 '\0'}, mid = 0, mchan = 0x0, mqid = {path = 0, vers = 0, type = 0 '\0'}, session = 0x0, name = 0x7f85540008c0} (gdb) down #0 0x000000000040aefa in consread (c=0x7f8500000000, buf=0x6e36a0, n=, off=0) at devcons.c:762 762 c->aux = clipread(); (gdb) p c $7 = (Chan *) 0x7f8500000000 - erik