bug-bash
[Top][All Lists]
Advanced

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

Re: No recursion limit in functions


From: Chet Ramey
Subject: Re: No recursion limit in functions
Date: Wed, 03 Dec 2003 09:59:08 -0500

> Frederik Meerwaldt <address@hidden> wrote:
> > (Illegal Instruction, Segmentation Fault, etc. - the signal heavily
> > depends on the platform).
> 
> That part is a bug.  bash should check for memory allocation errors.
> It seems to do so, but not perfectly:
> 
> $ softlimit -m 8000000 bash -c 'function xxx { xxx; }; xxx'
> bash: xmalloc: subst.c:5518: cannot allocate 112 bytes (0 bytes allocated)
> $ softlimit -m 16000000 bash -c 'function xxx { xxx; }; xxx'
> Segmentation fault
> 
> Of course, the bug might be in some underlying library code, not in
> bash itself.

It's not a bug.  Generally the signal is raised by the kernel when it
attempts to allocate more stack space for the recursive call.  Bash
uses xmalloc consistently and checks the return value when it does not.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    address@hidden    http://tiswww.tis.cwru.edu/~chet/




reply via email to

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