zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Lane Erickson <lerickson@liveramp.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: zsh glitch
Date: Tue, 10 Nov 2015 22:43:20 +0100	[thread overview]
Message-ID: <CAHYJk3S7oHyibz7iLKFuG8eTHhrVMWWiYEFDQnR1asw=1Y9nxw@mail.gmail.com> (raw)
In-Reply-To: <CAMzcTvN_JrZ4EcRbmV96ttwxsGhBQOZR8jJBoJ_rA2heN4w2Ng@mail.gmail.com>

On Tue, Nov 10, 2015 at 10:36 PM, Lane Erickson <lerickson@liveramp.com> wrote:
> http://stackoverflow.com/questions/33639879/strange-zsh-segfault-glitch-with-function-definitions

Please post the actual question to the mailing list. In 20 years when
someone reads this in the archive, stackoverflow might not exist
anymore ;).

> Does anyone know why this behavior exists in zsh, or what zsh is trying to do that causes a segfault?
>
> ➜  ~  (echo "hi"(); echo "hi"; echo "hi")
> [1]    65962 segmentation fault  ( echo "hi" () { ... }; echo "hi"; )
>
> ➜  ~  (ls(); ls; ls)
> [1]    66073 segmentation fault  ( ls -G () { ... }; ls -G; )

If it segfaults here, it's either because you're running an old
version or the compiler miscompiled, or the zsh code disagrees with
the compiler about what can be optimized out. What should happen is
the following:

% (ls(); ls; ls)
ls:1: maximum nested function level reached

What you've done is define a function that looks like this
ls() {
  ls
}
and then you call it, which causes an infinite recursion. This usually
does not end well in any language.

-- 
Mikael Magnusson


  reply	other threads:[~2015-11-10 21:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 21:36 Lane Erickson
2015-11-10 21:43 ` Mikael Magnusson [this message]
2015-11-11  9:36   ` Peter Stephenson
2015-11-12 15:48   ` Christian Neukirchen

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='CAHYJk3S7oHyibz7iLKFuG8eTHhrVMWWiYEFDQnR1asw=1Y9nxw@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=lerickson@liveramp.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).