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

Re: segfault due to chpwd_function



On Dec 11,  6:41pm, Peter Stephenson wrote:
}
} Are you able to post a self-contained function that shows the problem,
} with no external depenencies?

This seems to do it:

autoload -U promptinit
promptinit
prompt_chpwd() {
  ((RANDOM % 2)) && prompt bart || prompt zefram 
}
precmd_functions=(prompt_chpwd)

Program received signal SIGSEGV, Segmentation fault.
0x0807226c in hasher (str=0x10 <Address 0x10 out of bounds>)
    at ../../zsh-4.0/Src/hashtable.c:85
85          while ((c = *((unsigned char *) str++)))
(gdb) where
#0  0x0807226c in hasher (str=0x10 <Address 0x10 out of bounds>)
    at ../../zsh-4.0/Src/hashtable.c:85
#1  0x080725ab in gethashnode (ht=0xa0bf8e8, 
    nam=0x10 <Address 0x10 out of bounds>) at ../../zsh-4.0/Src/hashtable.c:231
#2  0x080c2580 in getshfunc (nam=0x10 <Address 0x10 out of bounds>)
    at ../../zsh-4.0/Src/utils.c:3007
#3  0x080be9e5 in callhookfunc (name=0x8148760 "precmd", lnklst=0x0, arrayp=1, 
    retval=0x0) at ../../zsh-4.0/Src/utils.c:1185
#4  0x080bebca in preprompt () at ../../zsh-4.0/Src/utils.c:1246
#5  0x0807b1ed in loop (toplevel=1, justonce=0) at ../../zsh-4.0/Src/init.c:121
#6  0x0807e2c6 in zsh_main (argc=2, argv=0xbff0cbd4)
    at ../../zsh-4.0/Src/init.c:1455
#7  0x0804cbea in main (argc=2, argv=0xbff0cbd4) at ../../zsh-4.0/Src/main.c:93


Note that I don't get the crash if I change from precmd_functions to
chpwd_functions, so my suspicion about "add-zsh-hook -D" seems to be
correct.



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