Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_V$
uname output: Linux frank-laptop 2.6.32-42-generic #96-Ubuntu SMP Wed Aug 15
18:57:09 UTC 2012 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu
Bash Version: 4.1
Patch Level: 5
Release Status: release
Description:
segmentation fault occur when I use deep recursive function.
Repeat-By:
the following content is my code
recursion()
{
if [ $1 -ne 15000 ] ;then
echo $1
let i=$1+1
recursion $i
fi
exit
}
recursion 1
Fix:
I use ulimit -s to find stack size, which is 8192kbytes. Then I use
valgrind to record the stack size which give me this information.
test.sh: xmalloc: ../bash/unwind_prot.c:308: cannot allocate 172 bytes (8359936
bytes allocated)
So from the above information I think this is not a stack overflow, and that is
a real fault in this program.
Regards,
Yuxiang Cao