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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_PCNT
	autolearn=no autolearn_force=no version=3.4.1
Date: Sat, 12 Mar 2016 04:11:16 +0100
From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: Re: segfault in completion for configure
Message-ID: <20160312031116.GC28459@zira.vinc17.org>
Mail-Followup-To: zsh-workers@zsh.org
References: <20160311134729.GA32476@cventin.lip.ens-lyon.fr>
 <20160311143202.4008e29b@pwslap01u.europe.root.pri>
 <160311150056.ZM30997@torch.brasslantern.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <160311150056.ZM30997@torch.brasslantern.com>
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/1.5.24-6562-vl-r87150 (2016-03-02)
X-Seq: zsh-workers 38139

On 2016-03-11 15:00:56 -0800, Bart Schaefer wrote:
> Shot in the [mostly] dark:  I see TRAPCHLD embedded in one of the strings
> in your backtrace.  Completion after "configure --" forks at least one
> child process (says valgrind) so if you have a TRAPCHLD function it's
> possible that it's corrupting something.  We do attempt signal handling
> during pattern matching in order that deep recursive globs can be stopped
> with SIGINT; it could be that needs a bit more regulation.

FYI, here's my TRAPCHLD:

TRAPCHLD()
{
  if [[ -o interactive && -n $TTY ]] then
    updprompt
    typeset -g _trapchld_called=1
  fi
}

with:

updprompt()
{
  psvar[2]=""

  unset _trapchld_called
  local njobs jobstr
  njobs=$#jobstates
  [[ $njobs -gt 1 ]] && jobstr="s"
  [[ $njobs -ge 1 ]] && jobstr=" $njobs job$jobstr |"

  [[ -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

  [[ -n $_trapchld_called ]] && updprompt
}

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

-- 
Vincent Lefèvre <vincent@vinc17.net> - 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)

