cc: [email protected]
> Subject: Re: [ast-users] KSH trap segfault question?
> --------
> 
> > Not sure if this is the correct mailing list for my question, but why
> does this
> > cause KSH to segfault?
> >
> > On ubuntu as a normal user:
> > $ function hist {
> > > cmd=$(fc -ln -0)
> > > print $cmd
> > > }
> >
> > $ trap hist DEBUG
> > $ w
> > Segmentation faul
> >
> > On Solaris 10 as a normal user:
> > $ function hist {
> > > cmd=$(fc -ln -0)
> > > print $cmd
> > > }
> > $ trap hist DEBUG
> > trap hist DEBUG
> >
> > $ ps -ef|grep root|wc -l
> > ps -ef|grep root|wc -l
> > Segmentation Fault (core dumped)
> > -bash-3.00$
> 
> The problem is that fc is a preset alias to hist, so that function hist
> becomes a recursive function without limit.  This should have reported
> 
>       hist: recursion too deep
> 
> but because of a bug, it core dumped instead.  I will fix this bug.
> 
> If you change your hist function to
> 
>       function hist
>       {
>               cmd=$(command fc -ln -0)
>               print "$cmd"
>       }
> 
> it will execute the builtin version of hist rather than the function.

Thank you, that's perfect. 

**********************************************************************
The e-mail and attachments are confidential and intended only for selected 
recipients. If you have received it in error, you may not in any way disclose 
or rely on the contents. You may not keep, copy or distribute the e-mail. 
Should you receive it, immediately notify the sender of the error and delete 
the e-mail.Also note that this form of communication is not secure, it can be 
intercepted, and may not necessarily be free of errors and viruses in spite of 
reasonable efforts to secure this medium.
**********************************************************************



_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to