From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17805 invoked by alias); 3 Mar 2014 23:44:57 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18552 Received: (qmail 26343 invoked from network); 3 Mar 2014 23:44:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham version=3.3.2 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Jan Larres Subject: Re: Local/global history with pattern isearch Date: Tue, 04 Mar 2014 12:44:24 +1300 Message-ID: References: <140302214400.ZM1868@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080400000602050000060505" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: yass.opencloud.co.nz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <140302214400.ZM1868@torch.brasslantern.com> --------------080400000602050000060505 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Okay, the good news first: I found the culprit! The issue was caused by the zsh-syntax-highlighting script (https://github.com/zsh-users/zsh-syntax-highlighting). If I stop sourcing that script everything works beautifully. The problems seems to stem from the fact that that script rebinds all of the widgets to invoke the highlighting routine after them: https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/zsh-syntax-highlighting.zsh#L127 Unfortunately I don't know enough about the widget stuff to pinpoint the exact reason this makes it fail. I've sourced that script after the zle changes so far, but a quick swapping of order doesn't seem to make any difference. During my tests I also found a way to make zsh segfault. While I still had the above script enabled I occasionally encountered some strange behaviour, described in this sequence: 1. Press ^r and enter something common like 'ls', the first result gets displayed 2. Press ^r again, a "failing bck-i-search" message gets displayed 3. Press ^r again, another result from the history gets displayed (huh?) 4. Press ^r again, "failing" message again and/or segfault In the cases where it doesn't segfault in step 4 pressing ^r more often after that just results in more "failing" messages. I've attached a full backtrace of the segfault case. This is with release 5.0.5 on Debian, by the way. On 03/03/14 18:44, Bart Schaefer wrote: > HOWEVER, I think this may be the source of the bug. Repeating the > search does not exit from the isearch keymap, so zle-isearch-exit is > always called between any two calls of the custom widget. Thus the > [[ $LASTWIDGET != history-incremental-pattern-search-backward ]] test > is probably incorrect part of the time. > > Try changing to > > history-incremental-pattern-search-backward() { > NUMERIC=0 zle set-local-history > zle .history-incremental-pattern-search-backward "$@" > } > > and see if that clears it up? This didn't change anything with the highlighting script still enabled, and I didn't see any immediate difference when doing some quick tests after disabling that script, but I'll try to investigate further. Thanks for the help! -Jan --------------080400000602050000060505 Content-Type: text/plain; charset=UTF-8; name="gdb.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdb.txt" #0 0x000000000048324c in metafy (buf=0x24007c7320
, len=40, heap=heap@entry=6) at ../../Src/utils.c:3985 meta = 0 t = p = e = 0x24007c7321
mbuf = '\000' #1 0x000000000042fd51 in igetmatch (sp=sp@entry=0x7fffffffc6d8, p=p@entry=0x7c7300, fl=fl@entry=8710, n=n@entry=0, replstr=replstr@entry=0x0, repllistp=repllistp@entry=0x7fffffffc7e8) at ../../Src/glob.c:2559 muststr = s = 0x80eea0 "less /usr/share/vim/vim73/syntax/dircolors.vim" t = 0x7fff00000000
tmatch = ioff = l = 46 matched = 1 umltot = 46 umlen = nmatches = repllist = 0x0 #2 0x00000000004349b0 in getmatchlist (str=str@entry=0x80eea0 "less /usr/share/vim/vim73/syntax/dircolors.vim", p=p@entry=0x7c7300, repllistp=repllistp@entry=0x7fffffffc7e8) at ../../Src/glob.c:2445 sp = 0x7fffffffc6d8 #3 0x00007ffff6abd316 in doisearch (args=, dir=-1, pattern=1) at ../../../Src/Zle/zle_hist.c:1308 t = 0x0 ibuf = 0x7ffff5de5220 "failing bck-i-search: ls" sbuf = 0x7ffff5de5236 "ls" last_line = 0x80ef60 "eval $(dircolors -b ~/.etc/zsh/zsh/dircolors) && ls_colors" zt = 0x80eea0 "less /usr/share/vim/vim73/syntax/dircolors.vim" sbptr = 2 top_spot = 5 sibuf = 80 nomatch = 0 skip_line = skip_pos = odir = -1 sens = 3 hl = 976 pos = 46 pat_hl = 977 pat_pos = 49 revert_patpos = 0 dup_ok = end_pos = 58 savekeys = -1 feep = 0 nosearch = 0 cmd = okeymap = 0x9bafa0 "main" he = 0x80ee40 patprog = 0x7c7300 matchlist = 0x0 exitfn = 0x0 aborted = 0 #4 0x00007ffff6ac311e in execzlefunc (func=func@entry=0x7ffff6cea588 , args=args@entry=0x7fffffffca88, set_bindk=set_bindk@entry=0) at ../../../Src/Zle/zle_main.c:1356 wflags = 1 r = 0 ret = 0 remetafy = 0 w = 0x7ffff6cec110 save_bindk = 0x7ffff6ce8a30 #5 0x00007ffff6ad158e in bin_zle_call (name=0x7ffff5de51d8 "zle", args=0x7fffffffca88, ops=, func=) at ../../../Src/Zle/zle_thingy.c:711 t = 0x7ffff6cea588 modsave = { flags = 1, mult = 1, tmult = 1, vibuf = 0, base = 10 } ret = saveflag = 0 setbindk = 0 wname = keymap_restore = 0x0 keymap_tmp = #6 0x000000000041cd76 in execbuiltin (args=args@entry=0x7ffff5de5178, bn=bn@entry=0x7ffff6ced540 ) at ../../Src/builtin.c:450 argarr = 0x7fffffffca80 argv = 0x7fffffffca80 pp = name = 0x7ffff5de51d8 "zle" optstr = 0x7ffff6adf1fb "aAcCDFgGIKlLmMNrRTUw" flags = 8 argc = execop = xtr = 0 ops = { ind = '\000' , args = 0x0, argscount = 0, argsalloc = 0 } #7 0x000000000042ad76 in execcmd (state=0x7fffffffd1c0, input=, output=, how=, last1=2) at ../../Src/exec.c:3274 restorelist = removelist = hn = args = filelist = 0x0 node = fn = mfds = {[0] = 0x0, [1] = 0x0, [2] = 0x0, [3] = 0x0, [4] = 0x0, [5] = 0x0, [6] = 0x0, [7] = 0x0, [8] = 0x0, [9] = 0x0} text = save = {[0] = -2, [1] = -2, [2] = -2, [3] = -2, [4] = -2, [5] = -2, [6] = -2, [7] = -2, [8] = -2, [9] = -2} fil = dfil = is_cursh = type = 6 do_exec = 0 redir_err = 0 i = htok = 1 nullexec = assign = forked = 0 is_shfunc = 0 is_builtin = is_exec = 0 use_defpath = 0 cflags = orig_cflags = 0 checked = oautocont = -1 redir = code = beg = varspc = 0x0 oxtrerr = 0x7ffff74a3060 <_IO_2_1_stderr_> newxtrerr = 0x0 #8 0x000000000042b2c3 in execpline2 (state=0x7fffffffd1c0, pcode=40, pcode@entry=323, how=18, input=0, output=0, last1=-14360, last1@entry=0) at ../../Src/exec.c:1691 pid = -11840 pipes = {[0] = 0, [1] = 0} #9 0x000000000042b7f4 in execpline (state=state@entry=0x7fffffffd1c0, slcode=, how=how@entry=18, last1=0) at ../../Src/exec.c:1478 ipipe = {[0] = 0, [1] = 0} opipe = {[0] = 0, [1] = 0} pj = 0 newjob = 1 old_simple_pline = 0 slflags = 0 code = 323 lastwj = 2 lpforked = 0 #10 0x000000000042cb72 in execlist (state=state@entry=0x7fffffffd1c0, dont_change_job=dont_change_job@entry=1, exiting=exiting@entry=0) at ../../Src/exec.c:1261 donedebug = 0 donetrap = 0 next = 0x7ffff7dfd4dc code = ret = cj = 0 csp = 0 ltype = 18 old_pline_level = 0 old_list_pipe = 0 oldlineno = 1 oldnoerrexit = 0 #11 0x000000000042ce52 in execode (p=p@entry=0x7bbd60, dont_change_job=dont_change_job@entry=1, exiting=exiting@entry=0, context=context@entry=0x48d4ce "shfunc") at ../../Src/exec.c:1070 s = { prog = 0x7bbd60, pc = 0x7ffff7dfd4dc, strs = 0x7ffff7dfdd95 "\205LASTWIDGET" } zsh_eval_context_len = 16 alen = #12 0x0000000000426c29 in runshfunc (prog=0x7bbd60, wrap=0x0, name=0x7ffff5de4f68 "history-incremental-pattern-search-backward") at ../../Src/exec.c:4865 cont = ouu = 6 ou = 0x9bafe0 "_BASE" #13 0x0000000000427226 in doshfunc (shfunc=shfunc@entry=0x7bbda0, doshargs=doshargs@entry=0x0, noreturnval=noreturnval@entry=1) at ../../Src/exec.c:4756 pptab = 0x6c1fd0 x = oargv0 = 0x6c1fb0 "/usr/bin/zsh" oldzoptind = 1 oldlastval = 0 oldoptcind = 0 oldnumpipestats = 1 ret = oldpipestats = 0x7ffff5de4f30 saveopts = "\000\001\000\001\000\001\000\000\001\001\000\001\001\001\001\000\001\001\001\000\000\000\001\001\001\001\001\000\000\000\000\001\000\000\000\001\001\000\000\000\000\000\000\000\000\001\000\001\000\000\001\001\001\001\000\000\001\001\001\001\000\000\000\000\001\001\000\001\000\001\000\000\000\001\000\001\000\000\000\000\001\000\000\000\000\000\000\000\000\001\001\000\000\000\000\000\000\001\001\000\000\001\000\000\000\000\001\000\000\000\000\001\001\001\001\000\001", '\000' , "\001\001\001\001\001\001\001\000\000\000\001\000\000\000\000\000\001\000\000\001\000\000\001\000\000\000\000\000\000\000\000\001\000\000\000\000\001" oldscriptname = 0x0 name = flags = ooflags = 0 fname = 0x7ffff5de4f00 "history-incremental-pattern-search-backward" obreaks = 0 saveemulation = 48 restore_sticky = 0 prog = fstack = { prev = 0x0, name = 0x7ffff5de4f68 "history-incremental-pattern-search-backward", filename = 0x7ffff5de4fa8 "/home/user/jan/.etc/zsh/zsh/zshrc.d/80_zle", caller = 0x7ffff5de4f98 "/usr/bin/zsh", flineno = 42, lineno = 1, tp = 1 } oflags = 0 save_sticky = 0x0 funcdepth = 1 #14 0x00007ffff6ac32c4 in execzlefunc (func=0x7ffff6ce8a30 , args=args@entry=0x7ffff6ced9c8 , set_bindk=set_bindk@entry=0) at ../../../Src/Zle/zle_main.c:1390 osc = 0 osi = 14 oxt = 0 largs = 0x0 shf = 0x7bbda0 r = 0 ret = 0 remetafy = 0 w = 0x7bc2d0 save_bindk = 0x7ffff6ce8a30 #15 0x00007ffff6ac3859 in zlecore () at ../../../Src/Zle/zle_main.c:1073 No locals. #16 0x00007ffff6ac4423 in zleread (lp=, rp=, flags=, context=, init=0x7ffff6adf099 "zle-line-init", finish=0x7ffff6adf089 "zle-line-finish") at ../../../Src/Zle/zle_main.c:1257 s = old_errno = 22 tmout = #17 0x000000000044019f in zleentry (cmd=1) at ../../Src/init.c:1477 ret = 0x0 ap = {[0] = { gp_offset = 40, fp_offset = 48, overflow_arg_area = 0x7fffffffd900, reg_save_area = 0x7fffffffd840 }} #18 0x0000000000441223 in inputline () at ../../Src/input.c:285 flags = 8155937 ingetcpmptl = 0x28 ingetcpmptr = 0x6 context = 49152 #19 ingetc () at ../../Src/input.c:221 No locals. #20 0x000000000043a0c6 in ihgetc () at ../../Src/hist.c:282 c = #21 0x000000000044b1be in gettok () at ../../Src/lex.c:714 peekfd = -1 #22 zshlex () at ../../Src/lex.c:395 No locals. #23 0x0000000000467e77 in parse_event () at ../../Src/parse.c:451 No locals. #24 0x000000000043d479 in loop (toplevel=toplevel@entry=1, justonce=justonce@entry=0) at ../../Src/init.c:132 prog = err = non_empty = 0 #25 0x00000000004407ae in zsh_main (argc=, argv=) at ../../Src/init.c:1633 errexit = 0 t = runscript = #26 0x00007ffff7120b45 in __libc_start_main (main=0x40efc0
, argc=1, argv=0x7fffffffdb68, init=, fini=, rtld_fini=, stack_end=0x7fffffffdb58) at libc-start.c:287 result = unwind_buf = { cancel_jmp_buf = {[0] = { jmp_buf = {[0] = 0, [1] = 5655022532906994327, [2] = 4255685, [3] = 140737488345952, [4] = 0, [5] = 0, [6] = -5655022534070875497, [7] = -5655039900245144937}, mask_was_saved = 0 }}, priv = { pad = {[0] = 0x0, [1] = 0x0, [2] = 0x48ba90 <__libc_csu_init>, [3] = 0x7fffffffdb68}, data = { prev = 0x0, cleanup = 0x0, canceltype = 4766352 } } } not_first_call = #27 0x000000000040efee in _start () No symbol table info available. --------------080400000602050000060505--