[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SEGFAULT if bash script make "source" for itself

From: Greg Wooledge
Subject: Re: SEGFAULT if bash script make "source" for itself
Date: Thu, 28 Aug 2014 14:54:21 -0400
User-agent: Mutt/

On Thu, Aug 28, 2014 at 11:49:02AM -0700, address@hidden wrote:
> So why I should got SIGSEGV instead of nice, detailed error message in
> recursion? We can detect it?

You can't detect that it's going to happen.  You can only receive the
SIGSEGV *after* it happens.

We already have a configurable switch that would have prevented your
original issue:

      Functions may be recursive.  The FUNCNEST variable may be used to
      limit the depth of the function call stack and restrict the number of
      function invocations.  By default, no limit is imposed on the number
      of recursive calls.

Just export FUNCNEST=1000 somewhere in your dotfiles and you'll never
have this particular seg fault again (assuming all your scripts run in
an environment that inherits this).

The default of 0 is quite reasonable, as others have already explained.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]