Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh glitch
- X-seq: zsh-workers 37088
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Lane Erickson <lerickson@xxxxxxxxxxxx>
- Subject: Re: zsh glitch
- Date: Tue, 10 Nov 2015 22:43:20 +0100
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=+V2KTjUdOpLENH3Th1UmvQGVEITVK2/vTLWsgAHCcQs=; b=utPmhFB6wBP0L4bcjL/ulmQlqz5IzajvUBivrxP+5uF2pFPJPy4YlAbfdjGunYKMd2 hxHnJbHQlz5iWM58UwQuandz23USpOaMNPl3rqbUjGBCNPZBaB9tr9A7k37V9aKfadEe s0LbIOltaSO06dqv+7qUw6i3zy6N2sAywF7I30HhxNRcPMVUihQuwpRVHQEqz5psPbNE NxsJQW40DeshqlkzHc4bA0k3y6vex/poPCfmSQiCaApSIshsDTuzrWFPqUD80XhshbQH 5YLVZRtBhsn21nbHh4hzHCMYiMFndyABc0P82bmKgxq/7xXmGZ8C4DDOE7gsDhqxSk6s POfw==
- In-reply-to: <CAMzcTvN_JrZ4EcRbmV96ttwxsGhBQOZR8jJBoJ_rA2heN4w2Ng@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAMzcTvN_JrZ4EcRbmV96ttwxsGhBQOZR8jJBoJ_rA2heN4w2Ng@mail.gmail.com>
On Tue, Nov 10, 2015 at 10:36 PM, Lane Erickson <lerickson@xxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author