From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27837 invoked by alias); 11 Feb 2016 04:01:40 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37944 Received: (qmail 16098 invoked from network); 11 Feb 2016 04:01:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=8vQNYZ7sw9mTJ3VxfVluU6cSVsIUdZ5zQnEENuwaZCo=; b=Xjo0c0h/sbZqfnQ+FuQqImkqWpQN+eHetI/M6lR4aEmMvPb5CyxZjAAvw5VkLqRnKc Rt2G2+wKyrbWJlMS3zIejWrFP53E6iBPfiZoHJSNRXE2Vxz8d/3GNnCLJ+Gc8GmbUjnE PEz2kSM9G0f219l7UuEDDiCm1y3LhzuggkbxA4/c0v0jHcCNJYi+2oUd6sJqbKJeZH6e jMzPRpxWR6A5CQtXprc2Dd23gdsNMdjoYD5tGYs/cSUQ7TUQtZB5EKMMUETv/HberTBk fvZVox6LfMtmVww9YhVD8SK+a3Xa6FY0XpZn9sGIEYQU8KhcmXDKE7rxIOb3dOXn6TQo PaNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=8vQNYZ7sw9mTJ3VxfVluU6cSVsIUdZ5zQnEENuwaZCo=; b=jHXTjzLAH4anfTERV+zpuT4jlZTINClx+n3RZvpgI2Fs+AMoQoZ+sWle5sU4bpWPhz 7rX75I0TFknVJ+i7ppYP1dHvoA/qIThdTcy7D2g1DmL1zOKw+YX1U+jFCzBoGkFdTsDm ee27hl6Ln/1BG3CV07jsHMi5MB/1F8PySrVQz72aimapxPosXkgoQ/4vg6PRF9FJldWI pBu4z7Co7pByNPoAi3Kf9acC0eHAlod6h5eYgHLxrTOcKGZCZNX54WMt7SrTjUKAizpM mgA+ZDQtr2nuv0jcbkWQr/q+Io/jbnlZars8iQUIU6IzCxUs5Ef1lPs3d2RJgvjo69zs JU2A== X-Gm-Message-State: AG10YORvbtXg3PTJG+JvG4YYYXQ5k1I8O6ct5izNYKQzpaCsDftjmKrYqarMgJWjGebNBA== X-Received: by 10.66.230.201 with SMTP id ta9mr63880361pac.52.1455163297244; Wed, 10 Feb 2016 20:01:37 -0800 (PST) From: Bart Schaefer Message-Id: <160210200147.ZM8455@torch.brasslantern.com> Date: Wed, 10 Feb 2016 20:01:47 -0800 In-Reply-To: Comments: In reply to Oscar Garcia Amor "Segfault on completion with interactive mode" (Feb 10, 5:40pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Segfault on completion with interactive mode MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii [ Long diagnosis follows; read just the first and last paragraphs for the short version. ] I think the problem is that "compadd -x" (which is used to show the warnings) updates the current group of completions to have an empty match with the warning as its explanation string. Because interactive mode is doing its own loop on getkeycmd(), the listing data is not restored after "compadd -x" clobbers it, and so the next time around the interactive mode loop, its idea of what is in the set of matches does not correspond, and chaos ensues. It comes down to this block of code in domenuselect(): if (nmessages) { showinglist = -2; zrefresh(); } else { trashzle(); zsetterm(); if (tccan(TCCLEAREOD)) tcout(TCCLEAREOD); fputs("no matches\r", shout); fflush(shout); tcmultout(TCUP, TCMULTUP, nlnct); showinglist = clearlist = 0; clearflag = 1; zrefresh(); showinglist = clearlist = 0; } statusline = NULL; goto getk; And earlier: getk: if (!do_last_key) { zmult = 1; cmd = getkeycmd(); /* * On interrupt, we'll exit due to cmd being empty. * Don't propagate the interrupt any further, which * can screw up redrawing. */ errflag &= ~ERRFLAG_INT; if (mtab_been_reallocated) { do_last_key = 1; continue; } } do_last_key = 0; When (nmessages) is true, we jump to getk:, do_last_key is false so we arrive at getkeycmd(), and mtab_been_reallocated is true so after reading the delete-char we continue back to the top of the "for (;;)" loop and finally crash inside the call to zrefresh() at line 2550 -- which I *think* is intended to redraw the old list before highlighing the desired item within it, but the old list has been replaced by the warning message. If there are no matches and (nmessages == 0), we go through the other branch [beginning with trashzle()]. Thereafter everything is the same except that we successfully redraw the list in zrefresh() and go on as we were. If showinglist is set to anything other than -2 in the (nmessages) true branch, there's no crash but the messages aren't shown either. If the list is invalidated (force listdat.valid = 0) then there also isn't a crash but menu selection exits. The thing is, I think domenuselect() has pushed all the right things onto its linked list of Menustack structures, it just hasn't ever restored it again. But I'm not sure and I haven't figured out the right place to restore it if so. Other eyeballs?