Re: [PATCH] dash: Fix stack overflow from infinite recursion in script

2019-07-18 Thread Jason Bowen
>  > +static int evalcount;/* number of nested evalfun calls */
>  ...
>  > + if (evalcount++ >= MAX_RECURSION)
>  > + sh_error("Maximum function recursion depth (%d) \
>  ...
>  > +#define MAX_RECURSION 1000   /* maximum recursion level */
>
> A couple of years ago i discovered mksh was crashing due to not
> having such a limit, and in the discussion which started with
> Thorsten (the mksh developer) it became obvious that a then-new
> bash seemed to have stopped using a limit; Thorsten's point was
> that the real limit can only be artitificial or very costly (if
> i recall correctly).  By then i sent Mr. Xu a message in private
> with i think a summary of all that, but never got any response.
> I know that the Lua scripting language seems be in the process of
> introducing such a limit with the upcoming release.

A recursion limit is not without precedent. CPython sets a platform-
dependent recursion limit for this same purpose:

https://docs.python.org/3/library/sys.html#sys.setrecursionlimit

But indeed, the limit is "artificial" or arbitrary. It should just be
"enough" that it isn't hit often with typical use.


Re: Arrays

2019-05-27 Thread Jason Bowen
Two goals of dash are to be small and POSIX compliant; arrays are
outside of that scope.

>From the description section of the dash man page:
> Only features designated by POSIX, plus a few Berkeley extensions,
> are being incorporated into this shell.

If you're willing to explain the problem you're trying to solve I'm
sure people are willing to help, but that help may not come in the form
of bash-style arrays in dash.