I think there needs to be a realistic cap which orients itself on uname -u.
On Linux I get this for uname -u:
max user processes              (-u) 5780

IMO best is that ksh93 itself restricts to this value to avoid out of
control scripts.

The alternative is to limit the number of ksh93 sub shells to 1/2 of
the available file descriptors (since sub shells consume 1 fd per sub
shell).

Olga

On Wed, Sep 19, 2012 at 8:09 PM, Terrence J. Doyle
<terrence.j.doyle+...@gmail.com> wrote:
>
> No matter what the subshell limit is, wouldn't it be better to exit gracefully
> with an error message like, "Too many subshells," when the limit is reached?
>
> Terrence Doyle
>
> On 9/18/12 10:00 AM, ольга крыжановская wrote:
>> Make the counter ssize_t? The bad thing is that ksh is full of shorts,
>> which should all be replaced with at least int32_t or uint32_t or some
>> thing bigger.
>>
>> Of course, the next question is, do you want so many sub shells? If
>> you do that do a shell which does fork() for a sub shell then you face
>> 32000 fork() calls. ksh93 with it's COW approach to sub shells is just
>> a lucky pick then.
>>
>> Olga
>>
>> On Tue, Sep 18, 2012 at 4:56 PM, Michal Hlavinka <mhlav...@redhat.com> wrote:
>>> Hi,
>>>
>>> we found a bug in ksh. It uses only short size int for curenv (current
>>> subshell number) and once it overflows, it crashes.
>>>
>>> Reproducer:
>>> ===============================================
>>> #!/bin/ksh
>>>
>>> main()
>>> {
>>>
>>>  typeset i=0;
>>>  typeset b="";
>>>
>>>   (while true
>>>   do
>>>     (b=$(printf %08d ${i}));
>>>     (( i = ${i} + 1 ))
>>>      echo $i;
>>>   done)
>>>   echo "count : ${i}";
>>> }
>>>
>>> main "$@";
>>> ===============================================
>>>
>>> ./test.sh
>>> ...
>>> ...
>>> 32765
>>> 32766
>>> 32767
>>> Segmentation fault
>>>
>>> Tested with ksh 2012-08-01. Let me know if you need more information.
>>>
>>> Michal
>>> _______________________________________________
>>> ast-developers mailing list
>>> ast-developers@research.att.com
>>> https://mailman.research.att.com/mailman/listinfo/ast-developers
>
>
> _______________________________________________
> ast-developers mailing list
> ast-developers@research.att.com
> https://mailman.research.att.com/mailman/listinfo/ast-developers



-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     olga.kryzhanov...@gmail.com   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to