With zsh 5.9 from Ubuntu 24.04 x86_64, or with the latest version from git (383526da422cf1c962d9be7e9e6ac166e226bf2b) compiled locally, the shell segfaults when I run a function that undefines then redefines itself. zsh -c 'foo () { unset -f foo; foo () { echo redefined; }; }; foo' [1] 89793 segmentation fault (core dumped) zsh -c 'foo () { unset -f foo; foo () { echo redefined; }; }; foo' This works with zsh 5.8.1 on Ubuntu 22.04 and older versions. Workaround: if you redefine a function within itself, make sure not to unset it first. This is simplified from real code in my .zshrc that decides on first use whether the command name foo should invoke the external command directly or be a function that wraps around it. -- Gilles