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

[microblaze-uclinux] Busybox MSH: Shell input nested too deeply.



Hi:

I'm running test scripts under uClinux which essentially are nested .sh
scripts (lower level sub-scripts are called inside top level ones).
Because of necessity to make all variables visible and changeable in
both directions, sub-scripts are not called, but sourced using MSH
(busybox Mini Shell) dot ('.') operator:

. <sub-script>

Very soon "Shell input nested too deeply" message shows up; I had to
increase MSH file name stack size from 8 to 192 to pass at least one
loop over all board interfaces. 

It looks like MSH doesn't free stack's entry when some sub-script is
completed so if the same sub-script is sourced again and again in the
loop, problem will happen even though actual nesting is rather shallow
(3 in our case).

Does any way exist to force MSH to free stack entry after script is
completed? I realize that sourced scripts run in the context of the same
shell.

To illustrate this behavior, I've created 2 simple scripts, resembling
what I'm doing:

# cat /tmp/sloop.sh
#!/bin/sh
#
counter=0;
for i in $loops; do
for j in $loops; do
for k in $loops; do
. one_loop.sh
done
done
done

# cat /tmp/one_loop.sh
counter=`expr $counter + 1`;
echo i=$i j=$j k=$k counter=$counter;

Then I run them on Microblaze target (uClinux 2.4):

# loops='1 2 3 4 5 6 7 8'
# . sloop.sh
i=1 j=1 k=1 counter=1
i=1 j=1 k=2 counter=2
i=1 j=1 k=3 counter=3
.....................
Shell input nested too deeply

i=8 j=8 k=8 counter=189

Note that my MSH has stack depth 192, not default 8.

Under bash or sh on my Linux PC it runs without any troubles. 

Thanks,

Leonid.

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/