Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 3.0.8 math bug?

On Thu, 17 Aug 2000, Dan Nelson wrote:

> Why does evaluating a non-numeric variable cause 3.0.8 to consume all
> available RAM and then exit to the parent shell?

The operational answer is "because all previous versions of zsh do that,
and it hasn't been fixed yet in 3.0.8."

The semantic answer is "because the value of a variable evaluated in math
context is treated as an expression, and that expression is itself


(( a )) --> b --> 7

a="3 + 4"
(( a )) --> 3 + 4 --> 7

(( a )) --> a --> a --> a --> ...

Hence in 3.1.somethingmorethan6butIforgetwhat, an arbitrary limit on the
depth of math recursion was imposed, and you get:

> zsh: math recursion limit exceeded

This does mean that there are expressions you can evaluate in 3.0.8 that
will eventually resolve to a value, which you can't evaluate in 3.1.9.  
They're a lot more complicated than anything you'd be likely to write out
by hand, though.

Messages sorted by: Reverse Date, Date, Thread, Author