zsh-workers
 help / color / mirror / code / Atom feed
* Segfault while testing __git_files functions
@ 2011-04-27  6:16 Benjamin R. Haskell
  2011-04-27  8:42 ` Mikael Magnusson
  2011-05-14  0:13 ` Peter Stephenson
  0 siblings, 2 replies; 5+ messages in thread
From: Benjamin R. Haskell @ 2011-04-27  6:16 UTC (permalink / raw)
  To: Zsh Workers

[-- Attachment #1: Type: TEXT/PLAIN, Size: 380 bytes --]

While trying to come up with a minimal "do __git_tree_files when I say 
__git_files" example, I came upon an error that gives me a reproducible 
segfault.

Attached test script can be run from `zsh -ldf`:

host% . ./git-break.zsh

It'll create a git repo, and prep it for the point where it'll break if 
you hit Tab.

Stack trace attached.  (built from rev 348d284)

-- 
Best,
Ben

[-- Attachment #2: Type: TEXT/PLAIN, Size: 453 bytes --]

# set up standard completion, removing cache
autoload -Uz compinit
rm -f ~/.zcompdump
compinit

# version of __git_files that elicits the segfault
__git_files () { __git_tree_files ${PREFIX:-.} HEAD }

# create a git repo that demonstrates the segfault
set -o err_exit
g=/tmp/break-zsh-git
rm -rf $g
mkdir -p $g
cd $g
git init
mkdir a
echo foo > a/a
git add a/a
git ci -ma

# prep for segfault (just hit <Tab>)
print -z git log a/

[-- Attachment #3: Type: TEXT/PLAIN, Size: 24749 bytes --]

Starting program: /tmp/zsh-r348d2842/bin/zsh -ldf

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff70131a2 in strlen () from /lib/libc.so.6
#0  0x00007ffff70131a2 in strlen () from /lib/libc.so.6
#1  0x000000000048da69 in ztrdup (s=0x7ffff7fab828 <Address 0x7ffff7fab828 out of bounds>) at string.c:52
#2  0x00007ffff5e46302 in dupmatch (m=0x7ffff7fefc20, nbeg=0, nend=0) at compcore.c:3232
#3  0x00007ffff5e46941 in permmatches (last=0) at compcore.c:3346
#4  0x00007ffff5e3ac91 in get_nmatches (pm=0x7e46e0) at complete.c:1267
#5  0x000000000046f02d in getstrvalue (v=0x7ffff7fb72a8) at params.c:1953
#6  0x000000000046d026 in getarg (str=0x7ffffffec870, inv=0x7ffffffec87c, v=0x7ffff7fb72a8, a2=0, w=0x7ffffffec868, prevcharlen=0x7ffffffec85c, nextcharlen=0x7ffffffec858) at params.c:1282
#7  0x000000000046e539 in getindex (pptr=0x7ffffffec900, v=0x7ffff7fb72a8, flags=0) at params.c:1670
#8  0x000000000046ec8d in fetchvalue (v=0x7ffff7fb72a8, pptr=0x7ffffffec9a8, bracks=1, flags=0) at params.c:1886
#9  0x000000000046e90c in getvalue (v=0x7ffff7fb72a8, pptr=0x7ffffffec9a8, bracks=1) at params.c:1807
#10 0x000000000045b205 in getmathparam (mptr=0x7ffffffeca10) at math.c:342
#11 0x000000000045b485 in mathevall (s=0x7ffff7fb7248 "compstate[nmatches]", prec_tp=MPREC_TOP, ep=0x7ffffffed738) at math.c:418
#12 0x000000000045df83 in matheval (s=0x7ffff7fb7248 "compstate[nmatches]") at math.c:1291
#13 0x000000000042851e in evalcond (state=0x7ffffffee140, fromtest=0x0) at cond.c:235
#14 0x0000000000433d1b in execcond (state=0x7ffffffee140, do_exec=0) at exec.c:4040
#15 0x000000000042b653 in execsimple (state=0x7ffffffee140) at exec.c:1068
#16 0x000000000042bafd in execlist (state=0x7ffffffee140, dont_change_job=1, exiting=0) at exec.c:1215
#17 0x000000000045a773 in execwhile (state=0x7ffffffee140, do_exec=0) at loop.c:410
#18 0x0000000000431b5e in execcmd (state=0x7ffffffee140, input=0, output=0, how=2, last1=2) at exec.c:3123
#19 0x000000000042d321 in execpline2 (state=0x7ffffffee140, pcode=1475, how=2, input=0, output=0, last1=0) at exec.c:1640
#20 0x000000000042c48b in execpline (state=0x7ffffffee140, slcode=205826, how=2, last1=0) at exec.c:1424
#21 0x000000000042bace in execlist (state=0x7ffffffee140, dont_change_job=1, exiting=0) at exec.c:1207
#22 0x000000000042b4ee in execode (p=0x7c0cd0, dont_change_job=1, exiting=0, context=0x4a851f "loadautofunc") at exec.c:1028
#23 0x00000000004347c0 in execautofn (state=0x7ffffffee8d0, do_exec=0) at exec.c:4298
#24 0x0000000000431b5e in execcmd (state=0x7ffffffee8d0, input=0, output=0, how=18, last1=2) at exec.c:3123
#25 0x000000000042d321 in execpline2 (state=0x7ffffffee8d0, pcode=3, how=18, input=0, output=0, last1=0) at exec.c:1640
#26 0x000000000042c48b in execpline (state=0x7ffffffee8d0, slcode=3074, how=18, last1=0) at exec.c:1424
#27 0x000000000042bace in execlist (state=0x7ffffffee8d0, dont_change_job=1, exiting=0) at exec.c:1207
#28 0x000000000042b4ee in execode (p=0x790470, dont_change_job=1, exiting=0, context=0x4a85b6 "shfunc") at exec.c:1028
#29 0x0000000000435304 in runshfunc (prog=0x790470, wrap=0x0, name=0x7ffff7fb6c18 "_alternative") at exec.c:4640
#30 0x00007ffff5e3b319 in comp_wrapper (prog=0x790470, w=0x0, name=0x7ffff7fb6c18 "_alternative") at complete.c:1455
#31 0x0000000000435269 in runshfunc (prog=0x790470, wrap=0x7ffff6059da0, name=0x7ffff7fb6c18 "_alternative") at exec.c:4625
#32 0x0000000000434fde in doshfunc (shfunc=0x790430, doshargs=0x7ffff7fb6b48, noreturnval=0) at exec.c:4534
#33 0x00000000004346a6 in execshfunc (shf=0x790430, args=0x7ffff7fb6b48) at exec.c:4262
#34 0x0000000000431d65 in execcmd (state=0x7fffffff0970, input=0, output=0, how=2, last1=2) at exec.c:3171
#35 0x000000000042d321 in execpline2 (state=0x7fffffff0970, pcode=1411, how=2, input=0, output=0, last1=0) at exec.c:1640
#36 0x000000000042c48b in execpline (state=0x7fffffff0970, slcode=5154, how=2, last1=0) at exec.c:1424
#37 0x000000000042bb1d in execlist (state=0x7fffffff0970, dont_change_job=1, exiting=0) at exec.c:1216
#38 0x000000000045ab2e in execif (state=0x7fffffff0970, do_exec=0) at loop.c:515
#39 0x0000000000431b5e in execcmd (state=0x7fffffff0970, input=0, output=0, how=18, last1=2) at exec.c:3123
#40 0x000000000042d321 in execpline2 (state=0x7fffffff0970, pcode=1219, how=18, input=0, output=0, last1=0) at exec.c:1640
#41 0x000000000042c48b in execpline (state=0x7fffffff0970, slcode=32770, how=18, last1=0) at exec.c:1424
#42 0x000000000042bace in execlist (state=0x7fffffff0970, dont_change_job=1, exiting=0) at exec.c:1207
#43 0x000000000045aef5 in execcase (state=0x7fffffff0970, do_exec=0) at loop.c:593
#44 0x0000000000431b5e in execcmd (state=0x7fffffff0970, input=0, output=0, how=18, last1=2) at exec.c:3123
#45 0x000000000042d321 in execpline2 (state=0x7fffffff0970, pcode=1091, how=18, input=0, output=0, last1=0) at exec.c:1640
#46 0x000000000042c48b in execpline (state=0x7fffffff0970, slcode=101378, how=18, last1=0) at exec.c:1424
#47 0x000000000042bace in execlist (state=0x7fffffff0970, dont_change_job=1, exiting=0) at exec.c:1207
#48 0x000000000045aef5 in execcase (state=0x7fffffff0970, do_exec=0) at loop.c:593
#49 0x0000000000431b5e in execcmd (state=0x7fffffff0970, input=0, output=0, how=18, last1=2) at exec.c:3123
#50 0x000000000042d321 in execpline2 (state=0x7fffffff0970, pcode=963, how=18, input=0, output=0, last1=0) at exec.c:1640
#51 0x000000000042c48b in execpline (state=0x7fffffff0970, slcode=109570, how=18, last1=0) at exec.c:1424
#52 0x000000000042bace in execlist (state=0x7fffffff0970, dont_change_job=1, exiting=0) at exec.c:1207
#53 0x000000000042b4ee in execode (p=0x7b7ec0, dont_change_job=1, exiting=0, context=0x4a85b6 "shfunc") at exec.c:1028
#54 0x0000000000435304 in runshfunc (prog=0x7b7ec0, wrap=0x0, name=0x7ffff7fc1718 "_git-log") at exec.c:4640
#55 0x00007ffff5e3b319 in comp_wrapper (prog=0x7b7ec0, w=0x0, name=0x7ffff7fc1718 "_git-log") at complete.c:1455
#56 0x0000000000435269 in runshfunc (prog=0x7b7ec0, wrap=0x7ffff6059da0, name=0x7ffff7fc1718 "_git-log") at exec.c:4625
#57 0x0000000000434fde in doshfunc (shfunc=0x79e4c0, doshargs=0x7ffff7fc16b0, noreturnval=0) at exec.c:4534
#58 0x00000000004346a6 in execshfunc (shf=0x79e4c0, args=0x7ffff7fc16b0) at exec.c:4262
#59 0x0000000000431d65 in execcmd (state=0x7fffffff1b30, input=0, output=0, how=2, last1=2) at exec.c:3171
#60 0x000000000042d321 in execpline2 (state=0x7fffffff1b30, pcode=1475, how=2, input=0, output=0, last1=0) at exec.c:1640
#61 0x000000000042c48b in execpline (state=0x7fffffff1b30, slcode=3074, how=2, last1=0) at exec.c:1424
#62 0x000000000042bace in execlist (state=0x7fffffff1b30, dont_change_job=1, exiting=0) at exec.c:1207
#63 0x000000000045ab2e in execif (state=0x7fffffff1b30, do_exec=0) at loop.c:515
#64 0x0000000000431b5e in execcmd (state=0x7fffffff1b30, input=0, output=0, how=2, last1=2) at exec.c:3123
#65 0x000000000042d321 in execpline2 (state=0x7fffffff1b30, pcode=1411, how=2, input=0, output=0, last1=0) at exec.c:1640
#66 0x000000000042c48b in execpline (state=0x7fffffff1b30, slcode=40962, how=2, last1=0) at exec.c:1424
#67 0x000000000042bace in execlist (state=0x7fffffff1b30, dont_change_job=1, exiting=0) at exec.c:1207
#68 0x000000000042b4ee in execode (p=0x7fecb0, dont_change_job=1, exiting=0, context=0x4a851f "loadautofunc") at exec.c:1028
#69 0x00000000004347c0 in execautofn (state=0x7fffffff22c0, do_exec=0) at exec.c:4298
#70 0x0000000000431b5e in execcmd (state=0x7fffffff22c0, input=0, output=0, how=18, last1=2) at exec.c:3123
#71 0x000000000042d321 in execpline2 (state=0x7fffffff22c0, pcode=3, how=18, input=0, output=0, last1=0) at exec.c:1640
#72 0x000000000042c48b in execpline (state=0x7fffffff22c0, slcode=3074, how=18, last1=0) at exec.c:1424
#73 0x000000000042bace in execlist (state=0x7fffffff22c0, dont_change_job=1, exiting=0) at exec.c:1207
#74 0x000000000042b4ee in execode (p=0x798d60, dont_change_job=1, exiting=0, context=0x4a85b6 "shfunc") at exec.c:1028
#75 0x0000000000435304 in runshfunc (prog=0x798d60, wrap=0x0, name=0x7ffff7fc1098 "_call_function") at exec.c:4640
#76 0x00007ffff5e3b319 in comp_wrapper (prog=0x798d60, w=0x0, name=0x7ffff7fc1098 "_call_function") at complete.c:1455
#77 0x0000000000435269 in runshfunc (prog=0x798d60, wrap=0x7ffff6059da0, name=0x7ffff7fc1098 "_call_function") at exec.c:4625
#78 0x0000000000434fde in doshfunc (shfunc=0x7974c0, doshargs=0x7ffff7fc0fe0, noreturnval=0) at exec.c:4534
#79 0x00000000004346a6 in execshfunc (shf=0x7974c0, args=0x7ffff7fc0fe0) at exec.c:4262
#80 0x0000000000431d65 in execcmd (state=0x7fffffff3bf0, input=0, output=0, how=18, last1=2) at exec.c:3171
#81 0x000000000042d321 in execpline2 (state=0x7fffffff3bf0, pcode=3395, how=18, input=0, output=0, last1=0) at exec.c:1640
#82 0x000000000042c48b in execpline (state=0x7fffffff3bf0, slcode=5122, how=18, last1=0) at exec.c:1424
#83 0x000000000042bace in execlist (state=0x7fffffff3bf0, dont_change_job=1, exiting=0) at exec.c:1207
#84 0x000000000045aef5 in execcase (state=0x7fffffff3bf0, do_exec=0) at loop.c:593
#85 0x0000000000431b5e in execcmd (state=0x7fffffff3bf0, input=0, output=0, how=18, last1=2) at exec.c:3123
#86 0x000000000042d321 in execpline2 (state=0x7fffffff3bf0, pcode=2947, how=18, input=0, output=0, last1=0) at exec.c:1640
#87 0x000000000042c48b in execpline (state=0x7fffffff3bf0, slcode=33794, how=18, last1=0) at exec.c:1424
#88 0x000000000042bace in execlist (state=0x7fffffff3bf0, dont_change_job=1, exiting=0) at exec.c:1207
#89 0x000000000045ab2e in execif (state=0x7fffffff3bf0, do_exec=0) at loop.c:515
#90 0x0000000000431b5e in execcmd (state=0x7fffffff3bf0, input=0, output=0, how=2, last1=2) at exec.c:3123
#91 0x000000000042d321 in execpline2 (state=0x7fffffff3bf0, pcode=1667, how=2, input=0, output=0, last1=0) at exec.c:1640
#92 0x000000000042c48b in execpline (state=0x7fffffff3bf0, slcode=92162, how=2, last1=0) at exec.c:1424
#93 0x000000000042bace in execlist (state=0x7fffffff3bf0, dont_change_job=1, exiting=0) at exec.c:1207
#94 0x000000000042b4ee in execode (p=0x7921e0, dont_change_job=1, exiting=0, context=0x4a85b6 "shfunc") at exec.c:1028
#95 0x0000000000435304 in runshfunc (prog=0x7921e0, wrap=0x0, name=0x7ffff7fd7568 "_git") at exec.c:4640
#96 0x00007ffff5e3b319 in comp_wrapper (prog=0x7921e0, w=0x0, name=0x7ffff7fd7568 "_git") at complete.c:1455
#97 0x0000000000435269 in runshfunc (prog=0x7921e0, wrap=0x7ffff6059da0, name=0x7ffff7fd7568 "_git") at exec.c:4625
#98 0x0000000000434fde in doshfunc (shfunc=0x792220, doshargs=0x7ffff7fd7520, noreturnval=0) at exec.c:4534
#99 0x00000000004346a6 in execshfunc (shf=0x792220, args=0x7ffff7fd7520) at exec.c:4262
#100 0x0000000000431d65 in execcmd (state=0x7fffffff4680, input=0, output=0, how=18, last1=2) at exec.c:3171
#101 0x000000000042d321 in execpline2 (state=0x7fffffff4680, pcode=386371, how=18, input=0, output=0, last1=0) at exec.c:1640
#102 0x000000000042c48b in execpline (state=0x7fffffff4680, slcode=3074, how=18, last1=0) at exec.c:1424
#103 0x000000000042bace in execlist (state=0x7fffffff4680, dont_change_job=1, exiting=0) at exec.c:1207
#104 0x000000000042b4ee in execode (p=0x824e70, dont_change_job=1, exiting=0, context=0x4a851f "loadautofunc") at exec.c:1028
#105 0x00000000004347c0 in execautofn (state=0x7fffffff4e10, do_exec=0) at exec.c:4298
#106 0x0000000000431b5e in execcmd (state=0x7fffffff4e10, input=0, output=0, how=18, last1=2) at exec.c:3123
#107 0x000000000042d321 in execpline2 (state=0x7fffffff4e10, pcode=3, how=18, input=0, output=0, last1=0) at exec.c:1640
#108 0x000000000042c48b in execpline (state=0x7fffffff4e10, slcode=3074, how=18, last1=0) at exec.c:1424
#109 0x000000000042bace in execlist (state=0x7fffffff4e10, dont_change_job=1, exiting=0) at exec.c:1207
#110 0x000000000042b4ee in execode (p=0x7af180, dont_change_job=1, exiting=0, context=0x4a85b6 "shfunc") at exec.c:1028
#111 0x0000000000435304 in runshfunc (prog=0x7af180, wrap=0x0, name=0x7ffff7feee50 "_git") at exec.c:4640
#112 0x00007ffff5e3b319 in comp_wrapper (prog=0x7af180, w=0x0, name=0x7ffff7feee50 "_git") at complete.c:1455
#113 0x0000000000435269 in runshfunc (prog=0x7af180, wrap=0x7ffff6059da0, name=0x7ffff7feee50 "_git") at exec.c:4625
#114 0x0000000000434fde in doshfunc (shfunc=0x7af140, doshargs=0x7ffff7feee10, noreturnval=0) at exec.c:4534
#115 0x00000000004346a6 in execshfunc (shf=0x7af140, args=0x7ffff7feee10) at exec.c:4262
#116 0x0000000000431d65 in execcmd (state=0x7fffffff58a0, input=0, output=0, how=18, last1=2) at exec.c:3171
#117 0x000000000042d321 in execpline2 (state=0x7fffffff58a0, pcode=131, how=18, input=0, output=0, last1=0) at exec.c:1640
#118 0x000000000042c48b in execpline (state=0x7fffffff58a0, slcode=3074, how=18, last1=0) at exec.c:1424
#119 0x000000000042bace in execlist (state=0x7fffffff58a0, dont_change_job=1, exiting=0) at exec.c:1207
#120 0x000000000042b4ee in execode (p=0x7ffff7feeda0, dont_change_job=1, exiting=0, context=0x4a675e "eval") at exec.c:1028
#121 0x0000000000423cea in eval (argv=0x7fffffff5970) at builtin.c:4908
#122 0x000000000042400a in bin_eval (nam=0x7ffff7feed38 "eval", argv=0x7fffffff5970, ops=0x7fffffff59a0, func=14) at builtin.c:5017
#123 0x00000000004109d7 in execbuiltin (args=0x7ffff7feecf0, bn=0x6bdba0) at builtin.c:450
#124 0x0000000000431dee in execcmd (state=0x7fffffff6900, input=0, output=0, how=2, last1=2) at exec.c:3182
#125 0x000000000042d321 in execpline2 (state=0x7fffffff6900, pcode=4099, how=2, input=0, output=0, last1=0) at exec.c:1640
#126 0x000000000042c48b in execpline (state=0x7fffffff6900, slcode=4130, how=2, last1=0) at exec.c:1424
#127 0x000000000042bb1d in execlist (state=0x7fffffff6900, dont_change_job=1, exiting=0) at exec.c:1216
#128 0x000000000045ab2e in execif (state=0x7fffffff6900, do_exec=0) at loop.c:515
#129 0x0000000000431b5e in execcmd (state=0x7fffffff6900, input=0, output=0, how=2, last1=2) at exec.c:3123
#130 0x000000000042d321 in execpline2 (state=0x7fffffff6900, pcode=3971, how=2, input=0, output=0, last1=0) at exec.c:1640
#131 0x000000000042c48b in execpline (state=0x7fffffff6900, slcode=43010, how=2, last1=0) at exec.c:1424
#132 0x000000000042bace in execlist (state=0x7fffffff6900, dont_change_job=1, exiting=0) at exec.c:1207
#133 0x000000000042b4ee in execode (p=0x824a00, dont_change_job=1, exiting=0, context=0x4a851f "loadautofunc") at exec.c:1028
#134 0x00000000004347c0 in execautofn (state=0x7fffffff7090, do_exec=0) at exec.c:4298
#135 0x0000000000431b5e in execcmd (state=0x7fffffff7090, input=0, output=0, how=18, last1=2) at exec.c:3123
#136 0x000000000042d321 in execpline2 (state=0x7fffffff7090, pcode=3, how=18, input=0, output=0, last1=0) at exec.c:1640
#137 0x000000000042c48b in execpline (state=0x7fffffff7090, slcode=3074, how=18, last1=0) at exec.c:1424
#138 0x000000000042bace in execlist (state=0x7fffffff7090, dont_change_job=1, exiting=0) at exec.c:1207
#139 0x000000000042b4ee in execode (p=0x7a45c0, dont_change_job=1, exiting=0, context=0x4a85b6 "shfunc") at exec.c:1028
#140 0x0000000000435304 in runshfunc (prog=0x7a45c0, wrap=0x0, name=0x7ffff7fee628 "_dispatch") at exec.c:4640
#141 0x00007ffff5e3b319 in comp_wrapper (prog=0x7a45c0, w=0x0, name=0x7ffff7fee628 "_dispatch") at complete.c:1455
#142 0x0000000000435269 in runshfunc (prog=0x7a45c0, wrap=0x7ffff6059da0, name=0x7ffff7fee628 "_dispatch") at exec.c:4625
#143 0x0000000000434fde in doshfunc (shfunc=0x7a4580, doshargs=0x7ffff7fee4b0, noreturnval=0) at exec.c:4534
#144 0x00000000004346a6 in execshfunc (shf=0x7a4580, args=0x7ffff7fee4b0) at exec.c:4262
#145 0x0000000000431d65 in execcmd (state=0x7fffffff7b20, input=0, output=0, how=18, last1=2) at exec.c:3171
#146 0x000000000042d321 in execpline2 (state=0x7fffffff7b20, pcode=2627, how=18, input=0, output=0, last1=0) at exec.c:1640
#147 0x000000000042c48b in execpline (state=0x7fffffff7b20, slcode=8194, how=18, last1=0) at exec.c:1424
#148 0x000000000042bace in execlist (state=0x7fffffff7b20, dont_change_job=1, exiting=0) at exec.c:1207
#149 0x000000000042b4ee in execode (p=0x81d850, dont_change_job=1, exiting=0, context=0x4a851f "loadautofunc") at exec.c:1028
#150 0x00000000004347c0 in execautofn (state=0x7fffffff82b0, do_exec=0) at exec.c:4298
#151 0x0000000000431b5e in execcmd (state=0x7fffffff82b0, input=0, output=0, how=18, last1=2) at exec.c:3123
#152 0x000000000042d321 in execpline2 (state=0x7fffffff82b0, pcode=3, how=18, input=0, output=0, last1=0) at exec.c:1640
#153 0x000000000042c48b in execpline (state=0x7fffffff82b0, slcode=3074, how=18, last1=0) at exec.c:1424
#154 0x000000000042bace in execlist (state=0x7fffffff82b0, dont_change_job=1, exiting=0) at exec.c:1207
#155 0x000000000042b4ee in execode (p=0x7cd410, dont_change_job=1, exiting=0, context=0x4a85b6 "shfunc") at exec.c:1028
#156 0x0000000000435304 in runshfunc (prog=0x7cd410, wrap=0x0, name=0x7ffff7fee1a8 "_normal") at exec.c:4640
#157 0x00007ffff5e3b319 in comp_wrapper (prog=0x7cd410, w=0x0, name=0x7ffff7fee1a8 "_normal") at complete.c:1455
#158 0x0000000000435269 in runshfunc (prog=0x7cd410, wrap=0x7ffff6059da0, name=0x7ffff7fee1a8 "_normal") at exec.c:4625
#159 0x0000000000434fde in doshfunc (shfunc=0x7cd3d0, doshargs=0x7ffff7fee148, noreturnval=0) at exec.c:4534
#160 0x00000000004346a6 in execshfunc (shf=0x7cd3d0, args=0x7ffff7fee148) at exec.c:4262
#161 0x0000000000431d65 in execcmd (state=0x7fffffff9470, input=0, output=0, how=2, last1=2) at exec.c:3171
#162 0x000000000042d321 in execpline2 (state=0x7fffffff9470, pcode=7555, how=2, input=0, output=0, last1=0) at exec.c:1640
#163 0x000000000042c48b in execpline (state=0x7fffffff9470, slcode=4130, how=2, last1=0) at exec.c:1424
#164 0x000000000042bb1d in execlist (state=0x7fffffff9470, dont_change_job=1, exiting=0) at exec.c:1216
#165 0x000000000045ab2e in execif (state=0x7fffffff9470, do_exec=0) at loop.c:515
#166 0x0000000000431b5e in execcmd (state=0x7fffffff9470, input=0, output=0, how=2, last1=2) at exec.c:3123
#167 0x000000000042d321 in execpline2 (state=0x7fffffff9470, pcode=7427, how=2, input=0, output=0, last1=0) at exec.c:1640
#168 0x000000000042c48b in execpline (state=0x7fffffff9470, slcode=114690, how=2, last1=0) at exec.c:1424
#169 0x000000000042bace in execlist (state=0x7fffffff9470, dont_change_job=1, exiting=0) at exec.c:1207
#170 0x000000000042b4ee in execode (p=0x813e60, dont_change_job=1, exiting=0, context=0x4a851f "loadautofunc") at exec.c:1028
#171 0x00000000004347c0 in execautofn (state=0x7fffffff9c00, do_exec=0) at exec.c:4298
#172 0x0000000000431b5e in execcmd (state=0x7fffffff9c00, input=0, output=0, how=18, last1=2) at exec.c:3123
#173 0x000000000042d321 in execpline2 (state=0x7fffffff9c00, pcode=3, how=18, input=0, output=0, last1=0) at exec.c:1640
#174 0x000000000042c48b in execpline (state=0x7fffffff9c00, slcode=3074, how=18, last1=0) at exec.c:1424
#175 0x000000000042bace in execlist (state=0x7fffffff9c00, dont_change_job=1, exiting=0) at exec.c:1207
#176 0x000000000042b4ee in execode (p=0x79ba70, dont_change_job=1, exiting=0, context=0x4a85b6 "shfunc") at exec.c:1028
#177 0x0000000000435304 in runshfunc (prog=0x79ba70, wrap=0x0, name=0x7ffff7fedb28 "_complete") at exec.c:4640
#178 0x00007ffff5e3b319 in comp_wrapper (prog=0x79ba70, w=0x0, name=0x7ffff7fedb28 "_complete") at complete.c:1455
#179 0x0000000000435269 in runshfunc (prog=0x79ba70, wrap=0x7ffff6059da0, name=0x7ffff7fedb28 "_complete") at exec.c:4625
#180 0x0000000000434fde in doshfunc (shfunc=0x79ba30, doshargs=0x7ffff7fedad0, noreturnval=0) at exec.c:4534
#181 0x00000000004346a6 in execshfunc (shf=0x79ba30, args=0x7ffff7fedad0) at exec.c:4262
#182 0x0000000000431d65 in execcmd (state=0x7fffffffbd20, input=0, output=0, how=18, last1=2) at exec.c:3171
#183 0x000000000042d321 in execpline2 (state=0x7fffffffbd20, pcode=10627, how=18, input=0, output=0, last1=0) at exec.c:1640
#184 0x000000000042c48b in execpline (state=0x7fffffffbd20, slcode=3074, how=18, last1=0) at exec.c:1424
#185 0x000000000042bace in execlist (state=0x7fffffffbd20, dont_change_job=1, exiting=0) at exec.c:1207
#186 0x000000000045aa93 in execif (state=0x7fffffffbd20, do_exec=0) at loop.c:500
#187 0x0000000000431b5e in execcmd (state=0x7fffffffbd20, input=0, output=0, how=2, last1=2) at exec.c:3123
#188 0x000000000042d321 in execpline2 (state=0x7fffffffbd20, pcode=10307, how=2, input=0, output=0, last1=0) at exec.c:1640
#189 0x000000000042c48b in execpline (state=0x7fffffffbd20, slcode=48130, how=2, last1=0) at exec.c:1424
#190 0x000000000042bace in execlist (state=0x7fffffffbd20, dont_change_job=1, exiting=0) at exec.c:1207
#191 0x0000000000459c8f in execfor (state=0x7fffffffbd20, do_exec=0) at loop.c:159
#192 0x0000000000431b5e in execcmd (state=0x7fffffffbd20, input=0, output=0, how=2, last1=2) at exec.c:3123
#193 0x000000000042d321 in execpline2 (state=0x7fffffffbd20, pcode=9795, how=2, input=0, output=0, last1=0) at exec.c:1640
#194 0x000000000042c48b in execpline (state=0x7fffffffbd20, slcode=90114, how=2, last1=0) at exec.c:1424
#195 0x000000000042bace in execlist (state=0x7fffffffbd20, dont_change_job=1, exiting=0) at exec.c:1207
#196 0x0000000000459c8f in execfor (state=0x7fffffffbd20, do_exec=0) at loop.c:159
#197 0x0000000000431b5e in execcmd (state=0x7fffffffbd20, input=0, output=0, how=2, last1=2) at exec.c:3123
#198 0x000000000042d321 in execpline2 (state=0x7fffffffbd20, pcode=8323, how=2, input=0, output=0, last1=0) at exec.c:1640
#199 0x000000000042c48b in execpline (state=0x7fffffffbd20, slcode=220162, how=2, last1=0) at exec.c:1424
#200 0x000000000042bace in execlist (state=0x7fffffffbd20, dont_change_job=1, exiting=0) at exec.c:1207
#201 0x000000000042b4ee in execode (p=0x813d40, dont_change_job=1, exiting=0, context=0x4a851f "loadautofunc") at exec.c:1028
#202 0x00000000004347c0 in execautofn (state=0x7fffffffc4b0, do_exec=0) at exec.c:4298
#203 0x0000000000431b5e in execcmd (state=0x7fffffffc4b0, input=0, output=0, how=18, last1=2) at exec.c:3123
#204 0x000000000042d321 in execpline2 (state=0x7fffffffc4b0, pcode=3, how=18, input=0, output=0, last1=0) at exec.c:1640
#205 0x000000000042c48b in execpline (state=0x7fffffffc4b0, slcode=3074, how=18, last1=0) at exec.c:1424
#206 0x000000000042bace in execlist (state=0x7fffffffc4b0, dont_change_job=1, exiting=0) at exec.c:1207
#207 0x000000000042b4ee in execode (p=0x7c14b0, dont_change_job=1, exiting=0, context=0x4a85b6 "shfunc") at exec.c:1028
#208 0x0000000000435304 in runshfunc (prog=0x7c14b0, wrap=0x0, name=0x7ffff7feb030 "_main_complete") at exec.c:4640
#209 0x00007ffff5e3b319 in comp_wrapper (prog=0x7c14b0, w=0x0, name=0x7ffff7feb030 "_main_complete") at complete.c:1455
#210 0x0000000000435269 in runshfunc (prog=0x7c14b0, wrap=0x7ffff6059da0, name=0x7ffff7feb030 "_main_complete") at exec.c:4625
#211 0x0000000000434fde in doshfunc (shfunc=0x7c1800, doshargs=0x0, noreturnval=0) at exec.c:4534
#212 0x00007ffff5e3dd1f in callcompfunc (s=0x7ffff7fef6a0 "a/", fn=0x80d740 "_main_complete") at compcore.c:828
#213 0x00007ffff5e3e5fc in makecomplist (s=0x7ffff7fef6a0 "a/", incmd=0, lst=0) at compcore.c:979
#214 0x00007ffff5e3c264 in do_completion (dummy=0x7ffff62ac3e8, dat=0x7fffffffc9b0) at compcore.c:349
#215 0x0000000000462ee9 in runhookdef (h=0x7ffff62ac3e8, d=0x7fffffffc9b0) at module.c:996
#216 0x00007ffff60942f3 in docompletion (s=0x81b5f0 "a/", lst=0, incmd=0) at zle_tricky.c:2179
#217 0x00007ffff608fb7e in docomplete (lst=0) at zle_tricky.c:859
#218 0x00007ffff608e2a4 in expandorcomplete (args=0x7ffff62ac950) at zle_tricky.c:315
#219 0x00007ffff608de89 in completecall (args=0x7ffff62ac950) at zle_tricky.c:208
#220 0x00007ffff607c4d8 in execzlefunc (func=0x7ffff62a9378, args=0x7ffff62ac950, set_bindk=0) at zle_main.c:1311
#221 0x00007ffff607b98e in zlecore () at zle_main.c:1058
#222 0x00007ffff607c0a2 in zleread (lp=0x6d19f8, rp=0x0, flags=3, context=0) at zle_main.c:1219
#223 0x00007ffff607ea97 in zle_main_entry (cmd=1, ap=0x7fffffffce30) at zle_main.c:1874
#224 0x000000000044beb9 in zleentry (cmd=1) at init.c:1374
#225 0x000000000044c919 in inputline () at input.c:281
#226 0x000000000044c790 in ingetc () at input.c:217
#227 0x00000000004410a8 in ihgetc () at hist.c:279
#228 0x000000000045630a in gettok () at lex.c:717
#229 0x0000000000455a9f in zshlex () at lex.c:395
#230 0x0000000000476be7 in parse_event () at parse.c:451
#231 0x0000000000448fc9 in loop (toplevel=1, justonce=0) at init.c:132
#232 0x000000000044c385 in zsh_main (argc=2, argv=0x7fffffffd208) at init.c:1528
#233 0x000000000040ff04 in main (argc=2, argv=0x7fffffffd208) at ./main.c:93

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

* Re: Segfault while testing __git_files functions
  2011-04-27  6:16 Segfault while testing __git_files functions Benjamin R. Haskell
@ 2011-04-27  8:42 ` Mikael Magnusson
  2011-04-27 15:07   ` Bart Schaefer
  2011-05-14  0:13 ` Peter Stephenson
  1 sibling, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2011-04-27  8:42 UTC (permalink / raw)
  To: Benjamin R. Haskell; +Cc: Zsh Workers

On 27 April 2011 08:16, Benjamin R. Haskell <zsh@benizi.com> wrote:
> While trying to come up with a minimal "do __git_tree_files when I say
> __git_files" example, I came upon an error that gives me a reproducible
> segfault.
>
> Attached test script can be run from `zsh -ldf`:
>
> host% . ./git-break.zsh
>
> It'll create a git repo, and prep it for the point where it'll break if you
> hit Tab.
>
> Stack trace attached.  (built from rev 348d284)

I wonder if this is the same crash as I have with the old git
completion, that also involved $PREFIX iirc. The top of the backtrace
looks quite similar too. Can you see if 'frame 2' says
#2  0x00007f2f68b38c84 in dupmatch (m=0x7f2f69be4298, nbeg=0, nend=0)
at compcore.c:3232
3232	 ztrdup(m->prpre);

(see also: http://www.zsh.org/mla/workers/2011/msg00391.html)

I would not have any complaints if anyone else fixed this btw :).

-- 
Mikael Magnusson


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

* Re: Segfault while testing __git_files functions
  2011-04-27  8:42 ` Mikael Magnusson
@ 2011-04-27 15:07   ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2011-04-27 15:07 UTC (permalink / raw)
  To: Zsh Workers

On Apr 27, 10:42am, Mikael Magnusson wrote:
}
} (see also: http://www.zsh.org/mla/workers/2011/msg00391.html)

Unfortunately I don't have anything new to add to the discussion in
the thread that follows from that message.


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

* Re: Segfault while testing __git_files functions
  2011-04-27  6:16 Segfault while testing __git_files functions Benjamin R. Haskell
  2011-04-27  8:42 ` Mikael Magnusson
@ 2011-05-14  0:13 ` Peter Stephenson
  2011-05-14  0:21   ` Mikael Magnusson
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2011-05-14  0:13 UTC (permalink / raw)
  To: Zsh Workers

On Wed, 27 Apr 2011 02:16:04 -0400 (EDT)
"Benjamin R. Haskell" <zsh@benizi.com> wrote:
> While trying to come up with a minimal "do __git_tree_files when I say 
> __git_files" example, I came upon an error that gives me a reproducible 
> segfault.
> 
> Attached test script can be run from `zsh -ldf`:
> 
> host% . ./git-break.zsh
> 
> It'll create a git repo, and prep it for the point where it'll break if 
> you hit Tab.

... thanks to this I was able to try the heap debugging and look at the
result.  However, it's nothing to do with using invalid heaps for the
matcher group itself, it's simply that one particular element of the
structure isn't being duplicated properly, so it didn't take much
tracking down.

I expect there are other problems, though.

Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.105
diff -p -u -r1.105 compcore.c
--- Src/Zle/compcore.c	18 Feb 2011 22:08:46 -0000	1.105
+++ Src/Zle/compcore.c	13 May 2011 23:18:31 -0000
@@ -2329,7 +2344,7 @@ addmatches(Cadata dat, char **argv)
 		dat->pre = dupstring(dat->pre);
 	    if (dat->suf)
 		dat->suf = dupstring(dat->suf);
-	    if (!dat->prpre && (dat->prpre = oppre)) {
+	    if (!dat->prpre && (dat->prpre = dupstring(oppre))) {
 		singsub(&(dat->prpre));
 		untokenize(dat->prpre);
 	    } else

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

* Re: Segfault while testing __git_files functions
  2011-05-14  0:13 ` Peter Stephenson
@ 2011-05-14  0:21   ` Mikael Magnusson
  0 siblings, 0 replies; 5+ messages in thread
From: Mikael Magnusson @ 2011-05-14  0:21 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh Workers

On 14 May 2011 02:13, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> On Wed, 27 Apr 2011 02:16:04 -0400 (EDT)
> "Benjamin R. Haskell" <zsh@benizi.com> wrote:
>> While trying to come up with a minimal "do __git_tree_files when I say
>> __git_files" example, I came upon an error that gives me a reproducible
>> segfault.
>>
>> Attached test script can be run from `zsh -ldf`:
>>
>> host% . ./git-break.zsh
>>
>> It'll create a git repo, and prep it for the point where it'll break if
>> you hit Tab.
>
> ... thanks to this I was able to try the heap debugging and look at the
> result.  However, it's nothing to do with using invalid heaps for the
> matcher group itself, it's simply that one particular element of the
> structure isn't being duplicated properly, so it didn't take much
> tracking down.

Hah.

(gdb) quit
Detaching from program: /usr/local/bin/zsh, process 19544
3823030 seconds elapsed
Date changed from 2011-03-30 to 2011-05-14

-- 
Mikael Magnusson


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

end of thread, other threads:[~2011-05-14  0:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-27  6:16 Segfault while testing __git_files functions Benjamin R. Haskell
2011-04-27  8:42 ` Mikael Magnusson
2011-04-27 15:07   ` Bart Schaefer
2011-05-14  0:13 ` Peter Stephenson
2011-05-14  0:21   ` Mikael Magnusson

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).