Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Bug in recursive function calls, source and exit



Hi,

In a French mailing-list, I've just heard of a bug related to
recursive function calls, source and exit; I don't think it has
been reported yet. Here's a way to reproduce it:

dixsept:~> zsh-beta -f
dixsept% echo $ZSH_VERSION 
4.3.0-dev-1
dixsept% echo false > ./file
dixsept% f() {
function> echo $[++i]
function> cat file
function> sleep 1
function> . ./file || echo exit > ./file
function> f
function> }
dixsept% which f
f () {
        echo $[++i]
        cat file
        sleep 1
        . ./file || echo exit > ./file
        f
}
dixsept% f
1
false
2
exit
3
exit
4
exit
5
exit
6
exit
[Ctrl-C]
dixsept:~>

FYI, bash doesn't have this problem:

[...]
vlefevre@dixsept:~$ f
1
false
2
exit
dixsept:~>

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA



Messages sorted by: Reverse Date, Date, Thread, Author