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

Re: Problems with source command in precmd()



On Dec 19, 10:49pm, Daniel Friesel wrote:
}
} there appear to be some crashes when using the source command in the
} precmd function.

I can reproduce this.  It's sufficient to run zsh -f and enter

precmd() { source /dev/null }

at the prompt, then accept-line a second time.

I get a different backtrace with --enable-zsh-mem.

*** glibc detected *** double free or corruption (!prev): 0x09e79ae8 ***
(gdb) where
#0  0x003047a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x00345825 in raise () from /lib/tls/libc.so.6
#2  0x00347289 in abort () from /lib/tls/libc.so.6
#3  0x00379d2a in __libc_message () from /lib/tls/libc.so.6
#4  0x0038072f in _int_free () from /lib/tls/libc.so.6
#5  0x00380baa in free () from /lib/tls/libc.so.6
#6  0x0808f7e3 in zfree (p=0x9e79ae8, sz=64) at ../../zsh-4.0/Src/mem.c:1500
#7  0x080777b5 in hend (prog=0x0) at ../../zsh-4.0/Src/hist.c:1271
#8  0x0807b3f7 in loop (toplevel=1, justonce=0) at ../../zsh-4.0/Src/init.c:133
#9  0x0807e476 in zsh_main (argc=2, argv=0xbfea3854)
    at ../../zsh-4.0/Src/init.c:1455
#10 0x0804cbea in main (argc=2, argv=0xbfea3854) at ../../zsh-4.0/Src/main.c:93


I'm not sure that's useful, as the first free() has already occurred by
then.  No code around there has changed especially recently. Possibly a
heap is getting popped while a global still has a pointer into it?



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