Subject: Re: segfault in completion for configure
From: Vincent Lefevre <[email-masked]>
To: [email-masked]
Date: Tue, 5 Apr 2016 14:49:50 +0200
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On 2016-03-19 19:07:57 -0700, Bart Schaefer wrote:
> The patch below crams all those globals into a struct so they can be
> saved/restored as one, and then tries pushing the signal queue management
> down into patmatch() from pattryrefs().  A side-effect of this patch is
> that the following is no longer guaranteed to work:
> 
>     typeset -i trap_handled;
>     TRAPUSR2() {
>       setopt localoptions extendedglob
>       [[ $somestring = (#b)$~somepattern ]]
>       trap_handled=1
>     }
>     TRAPUSR1() {
>       [[ $TERM = screen ]] && print $something
>     }
>     while true; do
>       if ((trap_handled)); then
>        trap_handled=0
>        print $match[0]	# This may not be the backref from TRAPUSR2
>       fi
>     done
> 
> Specifically, if the signals arrive in order USR1 USR2 such that USR2
> is handled during the [[ ]] expression in TRAPUSR1, then the state from
> TRAPUSR2 will be discarded.  I don't know if/how we ought to document.
> 
> Of course if this DOESN'T solve Vincent's crash, then all of the above
> is moot because I've mis-diagnosed again.

Sorry for the late reply, I was very busy. It seems that it solves
the crash! What I did is:

1. Compile and install zsh 5.2.
2. Check that the crash is still reproducible, and it is.
3. Apply this patch.
4. Recompile and reinstall zsh.
5. Test whether the crash is reproducible, and I couldn't reproduce it.

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)