bug-bash
[Top][All Lists]
Advanced

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

Re: alias-if-defun stack overflow


From: Chet Ramey
Subject: Re: alias-if-defun stack overflow
Date: Fri, 17 May 2002 12:45:26 -0400

> Machine Type: alphaev5-dec-osf5.1
> 
> Bash Version: 2.05
> Patch Level: 8
> Release Status: release
> 
> Description:
>   A stack overflow occurs when the following lines are input
>   from command line or with 'source':
>       alias mycmd='aword'
>       if true; then
>         mycmd() {
>           aword
>         }
>       fi
>       aword
>   I've seen this with similar input (some tests including 'unalias'
>   and 'unset'); this is the simplest I've been able to reduce it to.

You've managed to define a recursive function named `aword' and call it.
Eventually you're going to run out of stack space.

Remember that alias expansion is performed when a command is read, not
when it is executed.  Re-read the ALIASES section of the manual page,
paying particular attention to the next-to-last paragraph.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    chet@po.CWRU.Edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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