Re: a recursion bug

2012-10-03 Thread Greg Wooledge
On Wed, Oct 03, 2012 at 05:07:16AM +, Yuxiang Cao wrote: > Hi, > After second thought, I carefully read the bash manual page and find this > information. Functions may be recursive. The FUNCNEST variable may be used to > limit the depth of the function call stack and restrict the number of > fu

Re: a recursion bug

2012-10-03 Thread Chet Ramey
On 10/3/12 9:09 AM, Yuxiang Cao wrote: > Hi, > Actually, I just change to Solaris system and running your code which still > not work. FUNCNEST is a bash-4.2 feature, which you're apparently not running. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars long

Re: a recursion bug

2012-10-03 Thread Greg Wooledge
On Wed, Oct 03, 2012 at 01:00:21PM +, Yuxiang Cao wrote: > Hi, this is a interesting problem. Because My bash version is 4.1.5, so I > simply run the similar thing as your code which give me this > frank@frank-laptop:~/research/realfault$ bash -c 'FUNCNEST=100; a() { echo > "$1"; a $(($1+1)

RE: a recursion bug

2012-10-03 Thread Yuxiang Cao
Hi, Actually, I just change to Solaris system and running your code which still not work. Regards, Yuxiang Cao From: Yuxiang Cao Sent: Wednesday, October 03, 2012 11:00 PM To: Greg Wooledge Subject: RE: a recursion bug Hi, this is a interesting problem.

Re: a recursion bug

2012-10-03 Thread Linda A. Walsh
Steven W. Orr wrote: I think there's a fundamental misunderstanding between the difference of an error code returned by a system call and the exit status of a process. They're two completely different things. It's not a fundamental misunderstanding. It's a fundamental belief in us

Re: a recursion bug

2012-10-03 Thread Bob Proulx
Linda A. Walsh wrote: > Steven W. Orr wrote: > >I think there's a fundamental misunderstanding between the > >difference of an error code returned by a system call and the exit > >status of a process. They're two completely different things. > > It's not a fundamental misunderstanding.

Re: a recursion bug

2012-10-03 Thread Greg Wooledge
On Wed, Oct 03, 2012 at 01:23:58PM -0600, Bob Proulx wrote: > But in any case, is there > anything in there that is about bash? If so the we need an exact test > case. You could start with this one: imadev:~$ bash-4.2.28 -c 'a() { echo "$1"; a $(($1+1)); }; a 1' 2>&1 | tail Pid 4466 receive

Re: a recursion bug

2012-10-03 Thread Chet Ramey
On 10/3/12 3:40 PM, Greg Wooledge wrote: > On Wed, Oct 03, 2012 at 01:23:58PM -0600, Bob Proulx wrote: >> But in any case, is there >> anything in there that is about bash? If so the we need an exact test >> case. > > You could start with this one: > > imadev:~$ bash-4.2.28 -c 'a() { echo "$1";

Re: a recursion bug

2012-10-03 Thread Eric Blake
On 10/03/2012 01:23 PM, Bob Proulx wrote: >> But -- if it encountered an error, should it issue a SEGV and >> coredump message, or should it terminate the wayward script/function >> and return to the prompt? > > This is just the result of "Worse is Better". It is one of the > fundamentals t

Re: a recursion bug

2012-10-03 Thread Bob Proulx
Greg Wooledge wrote: > imadev:~$ bash-4.2.28 -c 'a() { echo "$1"; a $(($1+1)); }; a 1' 2>&1 | tail > Pid 4466 received a SIGSEGV for stack growth failure. > Possible causes: insufficient memory or swap space, > or stack size exceeded maxssiz. > 6534 > 6535 > 6536 > 6537 > 6538 > 6539 > 6540 > 6541

Re: a recursion bug

2012-10-03 Thread Bob Proulx
Chet Ramey wrote: > > Pid 4466 received a SIGSEGV for stack growth failure. > > Possible causes: insufficient memory or swap space, > > or stack size exceeded maxssiz. > > There's not actually anything you can do about that except use ulimit to > get as much stack space as you can. Well... There