zsh-users
 help / color / mirror / code / Atom feed
* Segmentation Fault on Stack Overflow
@ 2014-01-03 23:03 Russell Harmon
  2014-01-03 23:36 ` Frank Terbeck
  0 siblings, 1 reply; 5+ messages in thread
From: Russell Harmon @ 2014-01-03 23:03 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

Is this a known issue? If not, I'll put more effort into getting a stack
trace.

% zsh --version
zsh 5.0.2 (x86_64-apple-darwin13.0)
% function inf() { inf }; inf
zsh: correct 'inf' to 'info' [nyae]? n
zsh: correct 'inf' to 'info' [nyae]? n
[1]    11650 segmentation fault  zsh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation Fault on Stack Overflow
  2014-01-03 23:03 Segmentation Fault on Stack Overflow Russell Harmon
@ 2014-01-03 23:36 ` Frank Terbeck
  2014-01-04  1:16   ` Lawrence Velázquez
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Terbeck @ 2014-01-03 23:36 UTC (permalink / raw)
  To: Russell Harmon; +Cc: zsh-users

Russell Harmon wrote:
> Is this a known issue? If not, I'll put more effort into getting a stack
> trace.
>
> % zsh --version
> zsh 5.0.2 (x86_64-apple-darwin13.0)
> % function inf() { inf }; inf
> zsh: correct 'inf' to 'info' [nyae]? n
> zsh: correct 'inf' to 'info' [nyae]? n
> [1]    11650 segmentation fault  zsh

This is caused by infinite recursion. More recent versions of the shell
will react more reasonably:

zsh% function inf() { inf }; inf
inf: maximum nested function level reached

Regards, Frank


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation Fault on Stack Overflow
  2014-01-03 23:36 ` Frank Terbeck
@ 2014-01-04  1:16   ` Lawrence Velázquez
  2014-01-04  1:46     ` Frank Terbeck
  0 siblings, 1 reply; 5+ messages in thread
From: Lawrence Velázquez @ 2014-01-04  1:16 UTC (permalink / raw)
  To: Frank Terbeck; +Cc: Russell Harmon, zsh-users

On Jan 3, 2014, at 6:36 PM, Frank Terbeck <ft@bewatermyfriend.org> wrote:

> This is caused by infinite recursion. More recent versions of the shell
> will react more reasonably:
> 
> zsh% function inf() { inf }; inf
> inf: maximum nested function level reached

What version are you using? I'm seeing the segfault with the latest release.

    % zsh --version
    zsh 5.0.4 (x86_64-apple-darwin13.0.2)
    % zsh -c 'function inf() { inf }; inf'
    zsh: segmentation fault  zsh -c 'function inf() { inf }; inf'
    %

vq


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation Fault on Stack Overflow
  2014-01-04  1:16   ` Lawrence Velázquez
@ 2014-01-04  1:46     ` Frank Terbeck
  2014-01-05 17:58       ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Terbeck @ 2014-01-04  1:46 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: Russell Harmon, zsh-users

Lawrence Velázquez wrote:
> On Jan 3, 2014, at 6:36 PM, Frank Terbeck <ft@bewatermyfriend.org> wrote:
>> This is caused by infinite recursion. More recent versions of the shell
>> will react more reasonably:
>> 
>> zsh% function inf() { inf }; inf
>> inf: maximum nested function level reached
>
> What version are you using? I'm seeing the segfault with the latest release.
>
>     % zsh --version
>     zsh 5.0.4 (x86_64-apple-darwin13.0.2)
>     % zsh -c 'function inf() { inf }; inf'
>     zsh: segmentation fault  zsh -c 'function inf() { inf }; inf'
>     %

Huh. I must be remembering something incorrectly. The limit was in place
since sometime in 2000¹. But you might be building with the
‘--disable-max-function-depth’ configuration option.

Otherwise the limit should be in place (it defaults to 1000). If the
limit is in place, and the shell still crashes, it might be another
issue, which I couldn't reproduce then.

Regards, Frank

For the record, I've tried this with an older development version of
zsh: zsh-5.0.2-174-g8a70a98

¹ http://www.zsh.org/mla/workers/2000/msg01390.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation Fault on Stack Overflow
  2014-01-04  1:46     ` Frank Terbeck
@ 2014-01-05 17:58       ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2014-01-05 17:58 UTC (permalink / raw)
  To: zsh-users

On Sat, 04 Jan 2014 02:46:55 +0100
Frank Terbeck <ft@bewatermyfriend.org> wrote:
> >> zsh% function inf() { inf }; inf
> >> inf: maximum nested function level reached
> 
> Huh. I must be remembering something incorrectly. The limit was in place
> since sometime in 2000¹. But you might be building with the
> ‘--disable-max-function-depth’ configuration option.
> 
> Otherwise the limit should be in place (it defaults to 1000). If the
> limit is in place, and the shell still crashes, it might be another
> issue, which I couldn't reproduce then.

The function depth limit is only a guess at the point where problems
might occur.  It depends on the local environment, both the physical
configuration and the per-process limits, whether this is good enough.

It might be possible to do a little better by querying some of the
memory-related limits (I would guess available stack space is the key
one, but some investigation will be necessary) to see if one of the
limits is getting short and aborting function calls in a handlable
fashion at that level.  Unhelpfully, limits (from getrlimit()) and
current usage (from getrusage()) don't seem to map cleanly onto one
another, and this is all rather system-specific, so this doesn't look
like a trivial project.

pws


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-05 17:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-03 23:03 Segmentation Fault on Stack Overflow Russell Harmon
2014-01-03 23:36 ` Frank Terbeck
2014-01-04  1:16   ` Lawrence Velázquez
2014-01-04  1:46     ` Frank Terbeck
2014-01-05 17:58       ` Peter Stephenson

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).