Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
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 autolearn=ham
	autolearn_force=no version=3.4.1
X-AuditID: cbfec7f5-f79b16d000005389-c2-56bc836fa110
Date: Thu, 11 Feb 2016 12:49:48 +0000
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Segfault on completion with interactive mode
Message-id: <20160211124948.278fb707@pwslap01u.europe.root.pri>
In-reply-to: <160210200147.ZM8455@torch.brasslantern.com>
References:
 <CAPdr91afVtwZnv3o9FKqfgMeYg_1Tz9R-ujTVhJUwu4ErNtFng@mail.gmail.com>
 <160210200147.ZM8455@torch.brasslantern.com>
Organization: Samsung Cambridge Solution Centre
X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu)
MIME-version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7bit
X-Brightmail-Tracker:
 H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t/xy7r5zXvCDD5MFLM42PyQyYHRY9XB
	D0wBjFFcNimpOZllqUX6dglcGXM2XGAvuM9ZcfboXJYGxvvsXYycHBICJhIHFt1jhLDFJC7c
	W8/WxcjFISSwlFFidt8VVghnBpPEzNtPwTqEBM4xSjz8mAiROMsosfzvEzaQBIuAqsTRc+eZ
	QGw2AUOJqZtmg40VERCXOLv2PAuILSxgKfG79S5YDa+AvcT7DU9ZQWxOoPiDmeugtjUySvzc
	uRqsiF9AX+Lq309MEPfZS8y8coYRollQ4sfke2BDmQW0JDZva2KFsOUlNq95ywxxqbrEjbu7
	2ScwCs9C0jILScssJC0LGJlXMYqmliYXFCel5xrpFSfmFpfmpesl5+duYoQE9NcdjEuPWR1i
	FOBgVOLhDajfHSbEmlhWXJl7iFGCg1lJhNeqbE+YEG9KYmVValF+fFFpTmrxIUZpDhYlcd6Z
	u96HCAmkJ5akZqemFqQWwWSZODilGhi5zwRxsZ95EyoRxpCUdp+L15whkvuaWNff6EyF7xb/
	/ZaYbT6pFCn7OsqBi+H6zFVaUp/rFgSEPeX+NTmikqGvPKlObsNBA5ayT1nJTbmMTUcXZOsw
	B1s2Mjcmq/47fkPgvtzyNFnZN3t/5qad3rtB/3bs9/Vf/7DdMUqfubJBTnJN3ITV1kosxRmJ
	hlrMRcWJABW7xmZkAgAA
X-Seq: zsh-workers 37948

What I saw when I tried this was a crash in singledraw() because
mgtab[0] was 1, suggesting it as a "marked" null pointer.  So presumably
this state is incompatible with state required when we call
singledraw(),

    if (!mnew && inselect && onlnct == nlnct && mlbeg >= 0 && mlbeg == molbeg)
        singledraw();

This appears to be a lot later than anything you're talking about.

Preumably that pile of stuff in complistmatches inside "if (mnew) {" is
the key to what should be consistent.  It sounds like in the code you're
talking about, that code had just run, because mtab_been_reallocated was
1, whereas this time round, when it crashes, it hadn't.
("mtab_been_reallocated" seems to be associated with the 'if you've got
global variables you don't really need a calling convention' programming
style.)

So at the level I'm looking at it, it looks vaguely like it's in a state
as if "mnew" has just been set, in which case we'd skip the
singledraw(), and somehow we've got back too soon before all the stuff
that happens after to fix it up, whatever that is.

Anyway, the summary is I've completely failed to understand even the
most basic points of the logic that sets up the completion list
consistently.

pws

