[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash segfaults on simple function
From: |
Scott McDermott |
Subject: |
Re: bash segfaults on simple function |
Date: |
Tue, 29 Jul 2003 14:05:44 -0400 |
User-agent: |
Mutt/1.2.5.1i |
To chet@cwru.edu on Tue 29/07 14:04 -0400:
> > > $ type gg
> > > + type gg
> > > gg is a function
> > > gg ()
> > > {
> > > local search;
> > > local param;
> > > while true; do
> > > param=`echo "$1" | sed 's, ,%20,g'`;
> > > search="$search%22$param%22";
> > > shift;
> > > done;
> > > links
> > > "http://www.google.com/search?hl=en&ie=ISO=8859-1&q=$search"
> > > }
> > >
> > > $ gg
> >
> > You've written a dandy infinite loop there. Eventually
> > you're going to run out of some resource, and the shell
> > will probably crash.
>
> I know, but the shell should not segfault on an allocation
> failure, which appears to be what it's doing.
well maybe not allocation failure:
while true; do shift; done
it's not incorrect for that to segfault the shell?