From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 871 invoked by alias); 10 Nov 2015 21:43:25 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37088 Received: (qmail 20885 invoked from network); 10 Nov 2015 21:43:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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== MIME-Version: 1.0 X-Received: by 10.140.99.23 with SMTP id p23mr7400639qge.28.1447191800241; Tue, 10 Nov 2015 13:43:20 -0800 (PST) In-Reply-To: References: Date: Tue, 10 Nov 2015 22:43:20 +0100 Message-ID: Subject: Re: zsh glitch From: Mikael Magnusson To: Lane Erickson Cc: zsh workers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Nov 10, 2015 at 10:36 PM, Lane Erickson wr= ote: > http://stackoverflow.com/questions/33639879/strange-zsh-segfault-glitch-w= ith-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 t= o do that causes a segfault? > > =E2=9E=9C ~ (echo "hi"(); echo "hi"; echo "hi") > [1] 65962 segmentation fault ( echo "hi" () { ... }; echo "hi"; ) > > =E2=9E=9C ~ (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. --=20 Mikael Magnusson