Subject: Re: segfault in completion for configure
From: Bart Schaefer <[email-masked]>
To: [email-masked]
Date: Sat, 12 Mar 2016 08:20:29 -0800
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Mar 12,  4:11am, Vincent Lefevre wrote:
}
} On 2016-03-11 15:00:56 -0800, Bart Schaefer wrote:
} > [...] if you have a TRAPCHLD function it's
} > possible that it's corrupting something.
} 
} I can't reproduce the bug if I remove:
} 
}   [[ -n $TTY && $TERM == (xterm*|dtterm|mlterm|rxvt*|screen*) ]] &&
}     {
}       [[ $TERM == screen* ]] || print -nP "\e]1;%m${ptsn:+[$ptsn]}:%.\x07"
}       print -nP "\e]2;${jobstr}${WINTITLE:+ $WINTITLE |} %n@%m - %~ | %y\x07"
}     } > /dev/tty

What if you just remove the $TERM comparisons, i.e. leave the test of
$TTY and the print statement?

There are two static globals in pattern.c:

/* Flags used in both compilation and execution */
static int patflags;                /* flags passed down to patcompile */
static int patglobflags;  /* globbing flags & approx */

I'm guessing that re-entering pattern matching during the signal handler
is messing up those globals and leading eventually to the crash.