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

Crash with "fc -I" and/or zshaddhistory hook



I was fiddling with this:

zshaddhistory() { return 2 }
precmd() { [[ $? != 127 ]] && fc -I }

(yes, that's a typo, I meant -AI)

HISTSIZE=10 SAVEHIST=10 HISTFILE=/tmp/testhist

I got

precmd:fc: no such event: 10                                                    

and was confused (because I hadn't noticed the typo) so I hit enter several
times, eventually typed an actual command, and

precmd:fc: no such event: 10                                                    
torch% 
precmd:fc: no such event: 10                                                    
torch% 
precmd:fc: no such event: 10                                                    
torch% 
precmd:fc: no such event: 10                                                    
torch% echo foo
*** glibc detected *** double free or corruption (fasttop): 0x08a71a90 ***
zsh: abort (core dumped)  Src/zsh -f

I sort of suspect the problem is related to the history being completely
empty because zshaddhistory always returns 2, but why was "fc -I" trying
to select an event rather than just giving an error?

-- 
Barton E. Schaefer



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