bug-bash
[Top][All Lists]
Advanced

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

Re: a recursion bug


From: Eric Blake
Subject: Re: a recursion bug
Date: Wed, 03 Oct 2012 14:00:13 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1

On 10/03/2012 01:23 PM, Bob Proulx wrote:

>>      But -- if it encountered an error, should it issue a SEGV and
>> coredump message, or should it terminate the wayward script/function
>> and return to the prompt?
> 
> This is just the result of "Worse is Better".  It is one of the
> fundamentals that made Unix the wondeful system that we know it to be
> today.  You may not like it but it is a principle that has strongly
> shaped the system.
> 
>   http://en.wikipedia.org/wiki/Worse_is_better
> 
> The problem you are fighting is that every program on the system is
> governed by kernel stack limits.  If the program exceeds the policy
> limit then it will get a SIGSEGV for stack growth failure.
> 
> Now it is possible for a program to go to extreme efforts to trap that
> case and to deal explicitly with it.  But it isn't worth it.  Worse is
> better.  Better is an easy to maintain portable program.  Trying to
> deal with every possible problem on every possible system in every
> possible context will yield a worse solution.  Don't do it.

libsigsegv has already tackled this problem, making it very easy to
detect user-induced stack overflow with a minimum amount of additional
code.  Both GNU m4 and gawk have used libsigsegv to implement nicer
error handling in this situation, so maybe it is worth copying code from
these projects into bash.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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