bug-bash
[Top][All Lists]
Advanced

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

Re: Function/alias recursion


From: Eric Blake
Subject: Re: Function/alias recursion
Date: Tue, 16 Jan 2007 06:34:08 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Tim Waugh on 1/16/2007 5:45 AM:
> What is the intended behaviour for this sort of thing?:

Infinite recursion, within the limits of your stack.

> 
> $ cat <<"EOF" >trouble
> hello ()
> {
>     pwd
> }
> alias pwd="hello"
> EOF


> The behaviour I've observed with bash-3.2 and several earlier releases
> is that bash consumes all available memory and then crashes.

And why not?  It's the same as doing this in C:
int foo()
{
  return foo();
}

Bash can't protect you from yourself (or put differently, the halting
problem is undecidable).

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFrNRQ84KuGfSFAYARAsIxAJ9isSE1++l/vXvEzM0WBN0AbvkU2wCfWuPP
k7aE8j9sBQWzNZsqhD9mfRc=
=6ioK
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]