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
Date: Thu, 17 Mar 2016 20:09:48 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: zsh-workers@zsh.org
Subject: Re: segfault in completion for configure
Message-ID: <20160317200948.GA32439@tarsus.local2>
References: <20160311143202.4008e29b@pwslap01u.europe.root.pri>
 <160311150056.ZM30997@torch.brasslantern.com>
 <20160312031116.GC28459@zira.vinc17.org>
 <160312082029.ZM2340@torch.brasslantern.com>
 <160312093420.ZM14020@torch.brasslantern.com>
 <20160313215831.GA23404@zira.vinc17.org>
 <160314194323.ZM6887@torch.brasslantern.com>
 <20160317152435.GC11303@cventin.lip.ens-lyon.fr>
 <160317111515.ZM16697@torch.brasslantern.com>
 <20160317182406.2cb566ed@pwslap01u.europe.root.pri>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20160317182406.2cb566ed@pwslap01u.europe.root.pri>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 38176

Peter Stephenson wrote on Thu, Mar 17, 2016 at 18:24:06 +0000:
> Or is that if we know we've been int he signal handler at that point
> we already know the place where we needed to queue signals...

We could convert the pattern matching globals to macros that execute
code whenever the globals are accessed:

diff --git a/Src/pattern.c b/Src/pattern.c
index 72c7d97..a4fb24f 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -303,6 +303,12 @@ static long patalloc;              /* size allocated for same */
 static int patflags;               /* flags passed down to patcompile */
 static int patglobflags;  /* globbing flags & approx */
 
+#define patflags (f(), patflags)
+void f(void)
+{
+    /* ... */
+}
+
 /*
  * Increment pointer to metafied multibyte string.
  */

Now, f() can assert() some invariant, or check if SIGWINCH had been
delivered (and if so, drop into a gdb breakpoint), etc...

I'm proposing this just as a means of debugging for this one problem,
not as a permanent change.

Cheers,

Daniel

