[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Recursively calling a bash script goes undetected and eats all syste
Re: Recursively calling a bash script goes undetected and eats all system memory
Fri, 10 Dec 2010 10:19:20 +0000
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:18.104.22.168) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Thunderbird/3.1.6
> Would it not be simple to add some kind of protection against this
As already mentioned, recursion is a perfectly valid programming
technique so you really cannot forbid it (in fact it is equivalent to
Would you also forbid a shell function to call itself?
What you really want is proving termination. Unfortunately this is a
research topic <http://en.wikipedia.org/wiki/Termination_analysis>
Insanely dynamic languages like Unix shell scripting are the most
ill-suited for trying to prove anything.
> say don't let a script call itself more than 100 times?
Yes, in many environment you can configure a maximum recursion level
after which the program gone wild is killed. In your case "ulimit"
Re: Recursively calling a bash script goes undetected and eats all system memory,
Marc Herbert <=