zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: "Nicolas Desprès" <nicolas.despres@gmail.com>, zsh-workers@zsh.org
Subject: Re: Crash when completion script call itself.
Date: Fri, 29 Sep 2017 10:34:47 +0100	[thread overview]
Message-ID: <20170929103447.2fdbcb0f@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAPqtr1JyPEw1wQUCuLDihhmQe_kNkb2sdJ8sxB9YojPyqS_xSg@mail.gmail.com>

On Fri, 29 Sep 2017 20:25:44 +1300
Nicolas Desprès <nicolas.despres@gmail.com> wrote:
> $ cat >~/.zsh/Completion/_crash <<EOF
> 
> #compdef crash
> _crash "$@"
> EOF
> $ exec zsh
> $ crash [TAB] zsh: segmentation fault  zsh

This is certainly a real problem that people hit, but unfortuately
there's not a lot we can do to make a general robust fix.

There is already a check in the shell for the function recursion level;
the default value is 1000 (it is configurable at build time).  Some
systems will get this far without crashing, as mine does, and I get

_recurse: maximum nested function level reached

which is what's supposed to happen.

However, it's inevitable that systems vary in the resources they have
available so a single hard and fast limit doesn't always work.

I suspect that typically the crash happens when the user stack runs out
(which we can't detect portably, indeed it's hard enough to detect at
all as this is usually hidden from user-level code).  It would be
possible to store more function frame information in other forms of
memory which are much less likely to run out.  Unfortunately, while
things like this could help they are just moving the problem around a
bit and are quite hard to test widely enough to know if they're even
making an improvement.

pws


  reply	other threads:[~2017-09-29  9:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170929072715epcas1p4171c28e9b82f94d79796ecca7e564ec3@epcas1p4.samsung.com>
2017-09-29  7:25 ` Nicolas Desprès
2017-09-29  9:34   ` Peter Stephenson [this message]
2017-09-29 10:30     ` Nicolas Desprès
2017-09-29 10:40       ` Peter Stephenson
2017-09-29 10:45         ` Peter Stephenson
2017-09-29 11:03           ` Nicolas Desprès
2017-09-29 11:10             ` Peter Stephenson
2017-09-29 11:27               ` Kamil Dudka
2017-09-29 14:16                 ` Peter Stephenson
2017-09-29 15:22                   ` Bart Schaefer
2017-09-29 15:36                     ` Peter Stephenson
2017-09-29 17:48                       ` Bart Schaefer
2017-10-02 15:40                   ` Peter Stephenson
2017-10-03 14:45                     ` Kamil Dudka
2017-10-03 17:55                       ` Mikael Magnusson
2017-10-04  8:20                         ` Peter Stephenson
     [not found]                     ` <9379.1507044225@thecus.kiddle.eu>
2017-10-03 15:50                       ` Peter Stephenson
2017-09-29 23:00                 ` Nicolas Desprès
2017-09-29 11:38               ` Nicolas Desprès
2017-09-29 11:37         ` Martijn Dekker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170929103447.2fdbcb0f@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=nicolas.despres@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).